From e6527515bedf7f61dbe41a31ac1664a0930e7f2e Mon Sep 17 00:00:00 2001 From: SoSeDiK Date: Mon, 17 Jun 2024 00:53:39 +0300 Subject: [PATCH] Update Maven/Gradle usage --- wiki/Using-Gradle.md | 18 ++++++----- wiki/Using-Maven.md | 71 +++++++++++++++++++++++++------------------- 2 files changed, 52 insertions(+), 37 deletions(-) diff --git a/wiki/Using-Gradle.md b/wiki/Using-Gradle.md index 792279e6d..512f6f660 100644 --- a/wiki/Using-Gradle.md +++ b/wiki/Using-Gradle.md @@ -1,12 +1,17 @@ +To start using NB-API, you either need to depend on its plugin version, or shade (include) it inside your plugin. + +> [!IMPORTANT] +> Plugin and shaded versions have different ``artifactId``. Make sure to correctly choose the one you need! + # Option 1) NBT-API as a dependency -Add the following Entries to your Gradle build at the correct location: +Add the following entries to your Gradle build at the correct locations: ```groovy compileOnly("de.tr7zw:item-nbt-api-plugin:VERSION") ``` -(Get the current Version from [here](https://www.spigotmc.org/resources/nbt-api.7939/)) +(Get the current ``VERSION`` from [here](https://modrinth.com/plugin/nbtapi/versions)) ```groovy repositories { @@ -38,7 +43,6 @@ plugins { ``` The latest version of the shadow plugin can be found [here](https://github.com/johnrengelman/shadow/releases). -
Add NBT-API to your dependencies: @@ -46,9 +50,9 @@ Add NBT-API to your dependencies: implementation("de.tr7zw:item-nbt-api:VERSION") ``` -(Get the current Version from [here](https://www.spigotmc.org/resources/nbt-api.7939/)) +(Get the current ``VERSION`` from [here](https://modrinth.com/plugin/nbtapi/versions)) -> [!IMPORTANT] +> [!WARNING] > Make sure you're using ``item-nbt-api`` as ``artifactId``, never shade the ``-plugin`` artifact! ```groovy @@ -62,7 +66,7 @@ repositories { } ``` -After this you can add the shadowjar configuration to relocate the api package: +After this you can add the shadowJar configuration to relocate the API package: ```groovy shadowJar { @@ -70,7 +74,7 @@ shadowJar { } ``` -If you want to run the shadowJar task when the build task is executed, you can write like this: +If you want to run the shadowJar task when the build task is executed, you can use this: ```groovy build { diff --git a/wiki/Using-Maven.md b/wiki/Using-Maven.md index 421bbff17..b8de94259 100644 --- a/wiki/Using-Maven.md +++ b/wiki/Using-Maven.md @@ -1,6 +1,11 @@ +To start using NB-API, you either need to depend on its plugin version, or shade (include) it inside your plugin. + +> [!IMPORTANT] +> Plugin and shaded versions have different ``artifactId``. Make sure to correctly choose the one you need! + # Option 1) NBT-API as a dependency -Add the following Entries to your pom at the correct location: +Add the following entries to your pom at the correct locations: ```xml @@ -11,7 +16,7 @@ Add the following Entries to your pom at the correct location: ``` -(Get the current Version from [here](https://modrinth.com/plugin/nbtapi/versions)) +(Get the current ``VERSION`` from [here](https://modrinth.com/plugin/nbtapi/versions)) ```xml @@ -34,40 +39,16 @@ depend: [NBTAPI] # Option 2) Shading the NBT-API into your plugin -Add the following Entries to your pom at the correct location: - -```xml - - de.tr7zw - item-nbt-api - VERSION - -``` - -(Get the current Version from [here](https://modrinth.com/plugin/nbtapi/versions)) +To include NBT-API directly in your plugin, you can use the maven shade plugin. -> [!IMPORTANT] -> Make sure you're using ``item-nbt-api`` as ``artifactId``, never shade the ``-plugin`` artifact! - -```xml - -... - - -codemc-repo -https://repo.codemc.io/repository/maven-public/ -default - -... - -``` +Add the plugin to the build configuration, as shown here: ```xml org.apache.maven.plugins maven-shade-plugin - 3.4.1 + 3.6.0 shade @@ -89,7 +70,9 @@ Add the following Entries to your pom at the correct location: ``` -Example: +The latest version of the shade plugin can be found [here](https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-shade-plugin). + +Replace ``YOUR PACKAGE WHERE THE API SHOULD END UP`` with your own unique package. For example: ```xml @@ -98,3 +81,31 @@ Example: ``` +Then, add NBT-API to your dependencies by including the following entries to your pom at the correct locations: + +```xml + + de.tr7zw + item-nbt-api + VERSION + +``` + +(Get the current ``VERSION`` from [here](https://modrinth.com/plugin/nbtapi/versions)) + +> [!WARNING] +> Make sure you're using ``item-nbt-api`` as ``artifactId``, never shade the ``-plugin`` artifact! + +```xml + +... + + +codemc-repo +https://repo.codemc.io/repository/maven-public/ +default + +... + +``` +