Skip to content

Adding to your project

Kobting edited this page Sep 23, 2023 · 3 revisions

Maven

Note: This uses github packages which requires some setup. Documentation. Or you can just download the jars and add them to your project that way.

Add Repository

<repositories>
    <repository>
        <id>github</id>
        <name>GitHub Kobting STS-Annotations</name>
        <url>https://maven.pkg.github.com/kobting/STS-Annotations</url>
        <releases><enabled>true</enabled></releases>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>github</id>
        <name>GitHub Kobting STS-Annotations</name>
        <url>https://maven.pkg.github.com/kobting/STS-Annotations</url>
        <releases><enabled>true</enabled></releases>
    </pluginRepository>
</pluginRepositories>

Add dependency

<dependency>
    <groupId>com.github.kobting.sts-annotations</groupId>
    <artifactId>annotations</artifactId>
    <version>0.7.0</version>
</dependency>

Add plugins

build-helper-maven-plugin

This is used to add both java and kotlin sources to the project. This generates kotlin code so it is needed.

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>1.12</version>
    <executions>
        <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>
                    add-source
                </goal>
            </goals>
            <configuration>
                <sources>
                    <source>src/main/kotlin</source>
                    <source>src/main/java</source>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>

kotlin-maven-plugin

This is adding steps to compile kotlin code and enable KSP. This also adds this project and needed dependencies for compiling and running the KSP step.

<plugin>
    <groupId>org.jetbrains.kotlin</groupId>
    <artifactId>kotlin-maven-plugin</artifactId>
    <version>1.7.22</version>
    <executions>
        <execution>
            <id>compile</id>
            <phase>process-sources</phase>
            <goals>
                <goal>compile</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <jvmTarget>1.8</jvmTarget>
        <compilerPlugins>
            <compilerPlugin>ksp</compilerPlugin>
        </compilerPlugins>
        <pluginOptions>
            <option>ksp:apoption=resourceBasePath=${resourceBasePath}</option>
        </pluginOptions>
    </configuration>

    <dependencies>
        <dependency>
            <groupId>com.megacrit.cardcrawl</groupId>
            <artifactId>slaythespire</artifactId>
            <version>${SlayTheSpire.version}</version>
            <scope>system</scope>
            <systemPath>${Steam.path}/common/SlayTheSpire/desktop-1.0.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>com.evacipated.cardcrawl</groupId>
            <artifactId>modthespire</artifactId>
            <version>${ModTheSpire.version}</version>
            <scope>system</scope>
            <systemPath>${Steam.path}/workshop/content/646570/1605060445/ModTheSpire.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>basemod</groupId>
            <artifactId>basemod</artifactId>
            <version>5.29.0</version>
            <scope>system</scope>
            <systemPath>${Steam.path}/workshop/content/646570/1605833019/BaseMod.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>com.google.devtools.ksp</groupId>
            <artifactId>symbol-processing-api</artifactId>
            <version>1.7.22-1.0.8</version>
        </dependency>
        <dependency>
            <groupId>com.dyescape</groupId>
            <artifactId>kotlin-maven-symbol-processing</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>com.github.kobting.sts-annotations</groupId>
            <artifactId>processors</artifactId>
            <version>0.7.0</version>
        </dependency>
    </dependencies>
</plugin>

Clone this wiki locally