Skip to content

Annotation Processor

Daan van Yperen edited this page Aug 26, 2016 · 31 revisions

Configuring the Annotation Processor

Deprecated 1.4.0 users only. 2.0.0 users do not use the annotation processor.

Maven

+gwt, +desktop, +android, +ios

Add the following to enable annotation processing in maven. This should be sufficient for most IDE:s.

<dependency>
	<groupId>net.onedaybeard.artemis</groupId>
	<artifactId>artemis-odb-processor</artifactId>
	<version>1.4.0</version>
	<scope>provided</scope>
</dependency>

Gradle

+gwt, +desktop, +android, +ios

Add to your build script dependencies:

buildscript {
    dependencies {
        // introduces support for provided scope.
        classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:1.12.+'
    }
}

Add to your project dependencies:

project(":core") {
    apply plugin: 'provided-base'

    dependencies {
        provided "net.onedaybeard.artemis:artemis-odb-processor:1.4.0"
    }
}

see https://github.com/DaanVanYperen/libgdx-artemis-quickstart for a running example.

For android, see http://stackoverflow.com/questions/25649442/how-do-i-use-custom-java-annotation-processor-in-gradle

Eclipse (new way)

The command line tool's eclipse-ap command can configure existing eclipse projects.

$ java -jar /path/to/artemis-odb-cli-1.4.0.jar \
> eclipse-ap -p /path/to/eclipse/project

It is recommended to close the project in Eclipse before running the command. A project refresh (F5) may be required before Eclipse picks up the new project configuration.

Eclipse (old way)

Eclipse doesn't automatically pick up annotation processors from maven POM:s - they must be added manually.

  • Download the annotation processor.
  • Optionally copy the jar to someplace convenient
  • In the project containing components + entity factories
    • Java compiler > Annotation Processing, enable Enable annotation processing annotation processing
    • Java compiler > Annotation Processing > Factory Path, add the artemis processor jar annotation factory

IntellIJ IDEA 14

Make sure the annotation processors are on your classpath.

  • File > Settings (CTRL-ALT-S)
  • Build Execution, Development -> Compiler -> Annotation Processors
  • Check Enable Annotation Processing

At least required when using Gradle in combination with IntellIJ.

Clone this wiki locally