@@ -24,7 +24,15 @@ You will land into the `build.gradle.kts` file where you can add your dependenci
2424
2525### Adding Paper as a dependency
2626
27- To add Paper as a dependency, you will need to add the Paper repository to your ` build.gradle.kts ` or ` pom.xml ` file as well as the dependency itself.
27+ To add Paper as a dependency, you will need to add the Paper repository and dependency to your ` build.gradle.kts ` file.
28+
29+ :::tip
30+
31+ If you want to reference a specific build, you can do so by replacing the + with the build identifier
32+ (i.e. ` {VERSION}.build.25-alpha ` for the 25th alpha build of a version). Before ` 26.1 ` (` 1.21.11 ` and below), the
33+ version string format used was ` {VERSION}-R0.1-SNAPSHOT ` , with no way to reference a specific build.
34+
35+ :::
2836
2937<Tabs syncKey = " build-system" >
3038 <TabItem label = " Gradle (Kotlin)" >
@@ -37,29 +45,18 @@ To add Paper as a dependency, you will need to add the Paper repository to your
3745 }
3846
3947 dependencies {
40- compileOnly(" io.papermc.paper:paper-api:\{ LATEST_PAPER_RELEASE}-R0.1-SNAPSHOT " )
48+ compileOnly(" io.papermc.paper:paper-api:\{ LATEST_PAPER_RELEASE}.build.+ " )
4149 }
4250
4351 java {
44- toolchain.languageVersion.set(JavaLanguageVersion .of(21 ))
52+ toolchain.languageVersion.set(JavaLanguageVersion .of(25 ))
4553 }
4654 ```
4755 </TabItem >
48- <TabItem label = " Gradle (Groovy)" >
49- ``` groovy title="build.gradle" replace
50- repositories {
51- maven {
52- name = 'papermc'
53- url = 'https://repo.papermc.io/repository/maven-public/'
54- }
55- }
56+ <TabItem label = " Maven (Discouraged)" >
57+ Maven unfortunately does not support obtaining the latest version using version ranges the way Gradle
58+ does. You will need to explicitly declare the build of a version you are targeting.
5659
57- dependencies {
58- compileOnly 'io.papermc.paper:paper-api:\{LATEST_PAPER_RELEASE}-R0.1-SNAPSHOT'
59- }
60- ```
61- </TabItem >
62- <TabItem label = " Maven" >
6360 ``` xml title="pom.xml" replace
6461 <project >
6562 <repositories >
@@ -73,7 +70,7 @@ To add Paper as a dependency, you will need to add the Paper repository to your
7370 <dependency >
7471 <groupId >io.papermc.paper</groupId >
7572 <artifactId >paper-api</artifactId >
76- <version >\{LATEST_PAPER_RELEASE}-R0.1-SNAPSHOT </version >
73+ <version >\{LATEST_PAPER_BUILD_API_VERSION} </version >
7774 <scope >provided</scope >
7875 </dependency >
7976 </dependencies >
@@ -222,138 +219,6 @@ If everything went well, you should see something like this:
222219
223220![ ] ( ./assets/paper-plugin-overview.png )
224221
225- ## Plugin remapping
226-
227- As of 1.20.5, Paper ships with a Mojang-mapped runtime instead of reobfuscating the server to Spigot mappings.
228- If you are using Spigot/Bukkit plugins, your plugin will be assumed to be Spigot-mapped.
229- This means that the server will have to deobfuscate and remap the plugin JAR when it's loaded for the first time.
230-
231- :::note
232-
233- ` paperweight-userdev ` already sets this attribute automatically. For more information see the [ userdev] ( /paper/dev/userdev ) documentation.
234-
235- :::
236-
237- ### Mojang mappings
238-
239- To tell the server that your plugin is Mojang-mapped, you need to add the following code to your build script:
240-
241- :::note[ Paper plugins]
242-
243- If you are using Paper plugins, this step is not needed as plugins will be assumed to be Mojang-mapped.
244-
245- :::
246-
247- <Tabs syncKey = " build-system" >
248- <TabItem label = " Gradle (Kotlin)" >
249- ``` kotlin title="build.gradle.kts"
250- tasks.jar {
251- manifest {
252- attributes[" paperweight-mappings-namespace" ] = " mojang"
253- }
254- }
255- // if you have shadowJar configured
256- tasks.shadowJar {
257- manifest {
258- attributes[" paperweight-mappings-namespace" ] = " mojang"
259- }
260- }
261- ```
262- </TabItem >
263- <TabItem label = " Gradle (Groovy)" >
264- ``` groovy title="build.gradle"
265- jar {
266- manifest {
267- attributes(
268- 'paperweight-mappings-namespace': 'mojang'
269- )
270- }
271- }
272- // if you have shadowJar configured
273- shadowJar {
274- manifest {
275- attributes(
276- 'paperweight-mappings-namespace': 'mojang'
277- )
278- }
279- }
280- ```
281- </TabItem >
282- <TabItem label = " Maven" >
283- ``` xml title="pom.xml"
284- <plugin >
285- <groupId >org.apache.maven.plugins</groupId >
286- <artifactId >maven-jar-plugin</artifactId >
287- <version >3.4.1</version >
288- <configuration >
289- <archive >
290- <manifestEntries >
291- <paperweight-mappings-namespace >mojang</paperweight-mappings-namespace >
292- </manifestEntries >
293- </archive >
294- </configuration >
295- </plugin >
296- ```
297- </TabItem >
298- </Tabs >
299-
300- ### Spigot mappings
301-
302- If you explicitly want to tell the server that your plugin is Spigot-mapped, you need to add the following code to your build script:
303-
304- <Tabs syncKey = " build-system" >
305- <TabItem label = " Gradle (Kotlin)" >
306- ``` kotlin title="build.gradle.kts"
307- tasks.jar {
308- manifest {
309- attributes[" paperweight-mappings-namespace" ] = " spigot"
310- }
311- }
312- // if you have shadowJar configured
313- tasks.shadowJar {
314- manifest {
315- attributes[" paperweight-mappings-namespace" ] = " spigot"
316- }
317- }
318- ```
319- </TabItem >
320- <TabItem label = " Gradle (Groovy)" >
321- ``` groovy title="build.gradle"
322- jar {
323- manifest {
324- attributes(
325- 'paperweight-mappings-namespace': 'spigot'
326- )
327- }
328- }
329- // if you have shadowJar configured
330- shadowJar {
331- manifest {
332- attributes(
333- 'paperweight-mappings-namespace': 'spigot'
334- )
335- }
336- }
337- ```
338- </TabItem >
339- <TabItem label = " Maven" >
340- ``` xml title="pom.xml"
341- <plugin >
342- <groupId >org.apache.maven.plugins</groupId >
343- <artifactId >maven-jar-plugin</artifactId >
344- <version >3.4.1</version >
345- <configuration >
346- <archive >
347- <manifestEntries >
348- <paperweight-mappings-namespace >spigot</paperweight-mappings-namespace >
349- </manifestEntries >
350- </archive >
351- </configuration >
352- </plugin >
353- ```
354- </TabItem >
355- </Tabs >
356-
357222## Conclusion
358223
359224You should now have a project set up with Paper as a dependency.
0 commit comments