Adding the dependency
StrokkCommands is hosted on the eldonexus. It is split into two separate modules:
Module Name | Description |
---|---|
strokk-commands-annotations | This module holds the annotations for you to add in your source code. |
strokk-commands-processor | This module only holds the annotation processor. |
This separation is made with a very specific purpose in mind: To include only the most necessary classes in your
project classpath. Since the processor
module only contains internal logic classes (which can have similar
names as Brigadier itself), having them included in the classpath would make development experience very annoying.
Therefore, adding the dependency would look like this, depending on your build-system. The versions here are automatically fetched and thus always up to date.
Adding the repository
Section titled “Adding the repository”First, we have to add the repository:
repositories { maven { id = "eldonexus" url = "https://eldonexus.de/repository/maven-public/" }}
<repositories> <repository> <id>eldonexus</id> <url>https://eldonexus.de/repository/maven-public/</url> </repository></repositories>
Next up we add the dependency:
For Gradle, we simply add the annotations module as a compileOnly
and the processor module as a
annotationProcessor
dependency.
dependencies { compileOnly("net.strokkur:strokk-commands-annotations:1.3.0-SNAPSHOT") annotationProcessor("net.strokkur:strokk-commands-processor:1.3.0-SNAPSHOT")}
For Maven, we first have to add the annotation module as a dependency, with scope provided
so that
the annotations do not get included in the output jar.
<dependencies> <dependency> <group>net.strokkur</group> <artifactId>strokk-commands-annotations</artifactId> <version>1.3.0-SNAPSHOT</version> <scope>provided</scope> </dependency></dependencies>
Finally, we modify the compiler plugin and add a new annotation processor path for our processor module.
<pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.1</version> <configuration> <annotationProcessorPaths> <!-- Add annotation processor --> <annotationProcessorPath> <group>net.strokkur</group> <artifactId>strokk-commands-processor</artifactId> <version>1.3.0-SNAPSHOT</version> </annotationProcessorPath> </annotationProcessorPaths> </configuration> </plugin> </plugins></pluginManagement>