From ee5408764fbde7d8e5d251b804923ef902408070 Mon Sep 17 00:00:00 2001 From: Jeremy Wood Date: Thu, 24 Aug 2023 13:28:02 -0400 Subject: [PATCH 1/3] Fix dependency set for maven pom. --- build.gradle | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 67a517d1..49c72f90 100644 --- a/build.gradle +++ b/build.gradle @@ -44,26 +44,26 @@ repositories { } dependencies { - compileOnly 'org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT' + implementation 'org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT' implementation('com.github.MilkBowl:VaultAPI:1.7') { exclude group: 'org.bukkit', module: 'bukkit' } - api('me.main__.util:SerializationConfig:1.7') { + compileOnly('me.main__.util:SerializationConfig:1.7') { exclude group: 'org.bukkit', module: 'bukkit' } - api('com.pneumaticraft.commandhandler:CommandHandler:11') { + compileOnly('com.pneumaticraft.commandhandler:CommandHandler:11') { exclude group: 'org.bukkit', module: 'bukkit' exclude group: 'junit', module: 'junit' } - api 'com.dumptruckman.minecraft:buscript:2.0-SNAPSHOT' - api 'org.bstats:bstats-bukkit:2.2.1' - api('com.dumptruckman.minecraft:Logging:1.1.1') { + compileOnly 'com.dumptruckman.minecraft:buscript:2.0-SNAPSHOT' + compileOnly 'org.bstats:bstats-bukkit:2.2.1' + compileOnly('com.dumptruckman.minecraft:Logging:1.1.1') { exclude group: 'junit', module: 'junit' } - api 'de.themoep.idconverter:mappings:1.2-SNAPSHOT' - api 'org.jetbrains:annotations:16.0.2' + compileOnly 'de.themoep.idconverter:mappings:1.2-SNAPSHOT' + compileOnly 'org.jetbrains:annotations:16.0.2' testImplementation 'org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT' testImplementation('com.googlecode.json-simple:json-simple:1.1.1') { @@ -94,6 +94,10 @@ configurations { it.outgoing.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(jar) } it.outgoing.artifact(shadowJar) } + + shadowed.extendsFrom compileOnly { + canBeResolved = true + } } publishing { @@ -169,7 +173,7 @@ shadowJar { relocate 'org.codehaus.jettison', 'com.onarandombox.jettison' relocate 'de.themoep.idconverter', 'com.onarandombox.idconverter' - configurations = [project.configurations.api] + configurations = [project.configurations.shadowed] archiveFileName = "$baseName-$version.$extension" classifier = '' From bae909a9e8c245b9afb7f2a6df439478876f17db Mon Sep 17 00:00:00 2001 From: Jeremy Wood Date: Thu, 24 Aug 2023 13:49:48 -0400 Subject: [PATCH 2/3] Mark runtime dependency as provided in pom. --- build.gradle | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build.gradle b/build.gradle index 49c72f90..14277c48 100644 --- a/build.gradle +++ b/build.gradle @@ -104,6 +104,16 @@ publishing { publications { maven(MavenPublication) { from components.java + + pom.withXml { + asNode().dependencies.'*'.findAll() { + it.scope.text() == 'runtime' && project.configurations.implementation.allDependencies.find { dep -> + dep.name == it.artifactId.text() + } + }.each() { + it.scope*.value = 'provided' + } + } } } repositories { From 31f4f20bd87769e61ed46dc978e43a5d5b0a8d77 Mon Sep 17 00:00:00 2001 From: Jeremy Wood Date: Thu, 24 Aug 2023 13:50:04 -0400 Subject: [PATCH 3/3] Allow tests to see compileOnly dependencies. --- build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.gradle b/build.gradle index 14277c48..50b4587d 100644 --- a/build.gradle +++ b/build.gradle @@ -95,6 +95,9 @@ configurations { it.outgoing.artifact(shadowJar) } + testCompileOnly.extendsFrom compileOnly + testRuntimeOnly.extendsFrom testCompileOnly + shadowed.extendsFrom compileOnly { canBeResolved = true }