From 5fd22ba582577703ec88b574da5f6c85f9962861 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Sun, 24 Apr 2022 00:01:19 -0500 Subject: [PATCH] Fix publishing --- api/build.gradle | 20 +++++------ build.gradle | 81 +++++++++++++++++++++++---------------------- server/build.gradle | 52 ++++++++++++++--------------- 3 files changed, 76 insertions(+), 77 deletions(-) diff --git a/api/build.gradle b/api/build.gradle index 45d65b7..67f545b 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -1,23 +1,19 @@ -plugins { - id 'java' -} - group = rootProject.group version = rootProject.version description = "Plex-API" -repositories { - mavenCentral() - mavenLocal() - maven { - url = uri("https://papermc.io/repo/repository/maven-public/") - } -} - jar { archiveBaseName.set("Plex-API") } +publishing { + publications { + maven(MavenPublication) { + from components.java + } + } +} + dependencies { compileOnly "org.projectlombok:lombok:1.18.22" annotationProcessor "org.projectlombok:lombok:1.18.22" diff --git a/build.gradle b/build.gradle index 1bb92e8..65f3ec0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,54 +1,57 @@ plugins { id "java" id "maven-publish" - id "com.github.johnrengelman.shadow" version "7.1.2" } group = "dev.plex" version = "1.1-SNAPSHOT" description = "Plex" -java { - toolchain.languageVersion.set(JavaLanguageVersion.of(17)) -} +subprojects { + apply plugin: "java" + apply plugin: "maven-publish" -tasks.withType(JavaCompile) { - options.encoding = "UTF-8" -} - -publishing { - publications { - maven(MavenPublication) { - pom.withXml { - def dependenciesNode = asNode().appendNode("dependencies") - configurations.getByName("library").getAllDependencies().each { dependency -> - dependenciesNode.appendNode("dependency").with { - it.appendNode("groupId", dependency.group) - it.appendNode("artifactId", dependency.name) - it.appendNode("version", dependency.version) - it.appendNode("scope", "provided") - } - } - configurations.getByName("implementation").getAllDependencies().each { dependency -> - dependenciesNode.appendNode("dependency").with { - it.appendNode("groupId", dependency.group) - it.appendNode("artifactId", dependency.name) - it.appendNode("version", dependency.version) - it.appendNode("scope", "runtime") - } - } - } - artifacts = [shadowJar] - } - } repositories { maven { - def releasesRepoUrl = uri("https://nexus.telesphoreo.me/repository/plex-releases/") - def snapshotsRepoUrl = uri("https://nexus.telesphoreo.me/repository/plex-snapshots/") - url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl - credentials { - username = System.getenv("plexUser") - password = System.getenv("plexPassword") + url = uri("https://papermc.io/repo/repository/maven-public/") + } + + maven { + url = uri("https://repository.apache.org/content/repositories/snapshots/") + } + + maven { + url = uri("https://repo.maven.apache.org/maven2/") + } + + maven { + url = uri("https://jitpack.io") + content { + includeGroup("com.github.MilkBowl") + } + } + + mavenCentral() + } + + java { + toolchain.languageVersion.set(JavaLanguageVersion.of(17)) + } + + tasks.withType(JavaCompile) { + options.encoding = "UTF-8" + } + + publishing { + repositories { + maven { + def releasesRepoUrl = uri("https://nexus.telesphoreo.me/repository/plex-releases/") + def snapshotsRepoUrl = uri("https://nexus.telesphoreo.me/repository/plex-snapshots/") + url = rootProject.version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl + credentials { + username = System.getenv("plexUser") + password = System.getenv("plexPassword") + } } } } diff --git a/server/build.gradle b/server/build.gradle index 02d2ece..655186f 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -1,34 +1,8 @@ plugins { - id "java" - id "maven-publish" id "net.minecrell.plugin-yml.bukkit" version "0.6.1-SNAPSHOT" id "com.github.johnrengelman.shadow" version "7.1.2" } -repositories { - mavenLocal() - maven { - url = uri("https://papermc.io/repo/repository/maven-public/") - } - - maven { - url = uri("https://repository.apache.org/content/repositories/snapshots/") - } - - maven { - url = uri("https://repo.maven.apache.org/maven2/") - } - - maven { - url = uri("https://jitpack.io") - content { - includeGroup("com.github.MilkBowl") - } - } - - mavenCentral() -} - dependencies { library "org.projectlombok:lombok:1.18.22" annotationProcessor "org.projectlombok:lombok:1.18.22" @@ -133,4 +107,30 @@ tasks { javadoc { options.memberLevel = JavadocMemberLevel.PRIVATE } +} + +publishing { + publications { + maven(MavenPublication) { + pom.withXml { + def dependenciesNode = asNode().appendNode("dependencies") + configurations.getByName("library").getAllDependencies().each { dependency -> + dependenciesNode.appendNode("dependency").with { + it.appendNode("groupId", dependency.group) + it.appendNode("artifactId", dependency.name) + it.appendNode("version", dependency.version) + it.appendNode("scope", "provided") + } + } + configurations.getByName("implementation").getAllDependencies().each { dependency -> + dependenciesNode.appendNode("dependency").with { + it.appendNode("groupId", dependency.group) + it.appendNode("artifactId", dependency.name) + it.appendNode("version", dependency.version) + it.appendNode("scope", "runtime") + } + } + } + } + } } \ No newline at end of file