Add the following to the <project>
block of your pom.xml
to add the SpongeAPI dependency:
<repositories>
<repository>
<id>sponge</id>
<url>https://repo.spongepowered.org/maven</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spongepowered</groupId>
<artifactId>spongeapi</artifactId>
<version>5.1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
Alternatively, Sponge has a simple archetype that generates the basic structure for a plugin.
The generated pom includes a release profile that generates gpg-signed jars for javadocs, binary, and sources as recommended in the guidelines for submitting projects to Sonatype OSS (However, this option is not currently available for Sponge plugins due to the fact that Sponge API is not currently hosted on Maven Central).
The archetype plugin accepts a few properties:
Property | Example value | Description |
---|---|---|
groupId |
|
|
artifactId |
|
|
version |
|
|
package |
|
|
githubProject |
|
|
These can be specified as arguments to Maven in the form -Dproperty=value
This archetype requires Maven 3 or newer. Invoke maven with the goal archetype:generate
. Maven will prompt for any required properties, but optional properties must be specified on the command line.
$ mvn archetype:generate -DarchetypeArtifactId=sponge-plugin-archetype -DarchetypeGroupId=org.spongepowered -DarchetypeRepository=http://repo.spongepowered.org/maven -DarchetypeVersion=1.2 -DgithubProject=waylon531/spongeparty
The first four arguments specify where maven will find the archetype and which version to use. The -DgithubProject=waylon531/spongeparty
parameter is an optional property for the generated project and can be left out if you do not intend to host your plugin on GitHub.
After your project has been generated, you need to import it in your IDE. See ../workspace/index
for details.