-
Notifications
You must be signed in to change notification settings - Fork 144
Getting started with Ashley
The first thing you will want to do is to get Ashley into your project. You have a few options depending on your environment.
Ashley is available in Maven. The easiest way of going about this is to add the framework as a dependency of an existing Maven or Gradle project. There are two kinds of Ashley releases.
-
Official: well tested, stable packages that get released periodically. URL:
https://oss.sonatype.org/content/repositories/releases
-
Snapshots: the result of nightly builds, they are more likely to break in unexpected ways. URL:
https://oss.sonatype.org/content/repositories/snapshots
First, you need to add the desired repository to your pom.xml
file. Change the URL depending on whether you want releases or snapshots.
<repositories>
<repository>
<id>sonatype</id>
<name>Sonatype</name>
<url>https://oss.sonatype.org/content/repositories/releases</url>
</repository>
</repositories>
Then you need to add the Ashley dependency.
<dependency>
<groupId>com.badlogicgames.ashley</groupId>
<artifactId>ashley</artifactId>
<version>1.7.3</version>
</dependency>
Add the Maven repositories to your build.gradle
file.
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
Add the dependency to the dependencies
element.
dependencies {
implementation "com.badlogicgames.ashley:ashley:1.7.3"
}
If you want the bleeding edge version of Ashley, you can get the nightly builds by using the dependency: com.badlogicgames.ashley:ashley:1.7.4-SNAPSHOT
.
If you want the most bleeding edge version of Ashley or prefer to make your own modifications, working from sources might be the best option. Follow these steps.
- Install Gradle
- Clone the Git repository
git clone [email protected]:libgdx/ashley.git
- Import the
core
andtests
projects into the IDE of your choice. Using the command line is also an option. - Now you can either:
- Run the
uploadArchives
task and generate three jar files: bytecode, sources and javadocs. They will be in your local Maven repository. - Add the
ashley
project as a dependency to yours.
If you are creating a new Libgdx project from scratch, use the gdx-setup tool and tick the Ashley checkbox.
On the other hand, if you already have a Libgdx project and want to use Ashley you need to add the appropriate repository to the `build.gradle' file as we saw in the previous section. Additionally, you will need to add the following dependencies to your projects.
project(":core") {
dependencies {
implementation "com.badlogicgames.ashley:ashley:1.7.3"
}
}
project(":android") {
dependencies {
implementation "com.badlogicgames.ashley:ashley:1.7.3"
}
}
project(":html") {
dependencies {
implementation "com.badlogicgames.ashley:ashley:1.7.3:sources"
}
}
If you are targeting the browser, do not forget to update your GdxDefinition.gwt.xml
and GdxDefinitionSuperdev.gwt.xml
files with the proper inheritance element.
<inherits name='com.badlogic.ashley_gwt' />