publish both artifacts

This commit is contained in:
Telesphoreo 2022-04-23 23:42:01 -05:00
parent 36877ae2f2
commit ead38212d5
No known key found for this signature in database
GPG Key ID: B5CDDEBA526C0130
3 changed files with 61 additions and 51 deletions

View File

@ -2,8 +2,9 @@ plugins {
id 'java' id 'java'
} }
group 'dev.plex' group = rootProject.group
version '1.1-SNAPSHOT' version = rootProject.version
description = "Plex-API"
repositories { repositories {
mavenCentral() mavenCentral()

55
build.gradle Normal file
View File

@ -0,0 +1,55 @@
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))
}
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")
}
}
}
}

View File

@ -58,9 +58,9 @@ dependencies {
implementation project(":api") implementation project(":api")
} }
group = "dev.plex" group = rootProject.group
version = "1.1-SNAPSHOT" version = rootProject.version
description = "Plex" description = "Plex-Server"
shadowJar { shadowJar {
archiveBaseName.set("Plex") archiveBaseName.set("Plex")
@ -120,52 +120,6 @@ task buildProperties {
} }
} }
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
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")
}
}
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
tasks { tasks {
build { build {
dependsOn(shadowJar) dependsOn(shadowJar)