Using the Paper API

The Paper API is available from the PaperMC Maven repository. This tool can provide the source code, compiled jars, and javadocs to your project.

Repository

Add this to your pom.xml:

<repository>
    <id>papermc</id>
    <url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
Dependency

Then, add this:

<dependency>
    <groupId>io.papermc.paper</groupId>
    <artifactId>paper-api</artifactId>
    <version></version>
    <scope>provided</scope>
</dependency>
Maven compiler plugin

Lastly, point the maven compiler plugin to Java 17

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.1</version>
    <configuration>
        <release>17</release>
    </configuration>
</plugin>
Repository

Add this to your build.gradle.kts:

repositories {
    maven { url = uri("https://repo.papermc.io/repository/maven-public/") }
}
Dependency

Then, add this:

dependencies {
    compileOnly("io.papermc.paper:paper-api:")
}
Toolchain

Lastly, point the toolchain to Java 17:

java {
    toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}