Skip to content

Maven Import

Dalton edited this page Apr 29, 2022 · 18 revisions

Maven importing

Do note you will need a shade plugin for this to be shaded into your plugins jar

Note: If you already have a shade plugin setup, then skip to the last 2 code blocks.

    <build>
        <plugins>
            . . .
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            . . .
        </plugins>
    </build>

Then, you need the JitPack repository added to your project:

<repositories>
    <!-- JitPack for GitHub projects -->
    <repository>
        <id>jitpack.io</id>
        <!-- This has "www" because: https://stackoverflow.com/questions/54928706/error-in-library-built-with-jitpack-unable-to-resolve-dependency-for-appdebu -->
        <url>https://www.jitpack.io</url>
    </repository>
</repositories>

And finally you can add the Maven dependency inside your dependencies, make sure the scope is compile or the API wont shade!

<dependencies>
    <dependency>
        <groupId>com.github.Burchard36</groupId>
        <artifactId>BurchAPI</artifactId>
        <version>2.1.7</version>
        <scope>compile</scope>
    </dependency>
</dependencies>
Clone this wiki locally