Skip to content

Commit

Permalink
Add Gradle configration to publish platform artifacts to Maven Centra…
Browse files Browse the repository at this point in the history
…l Sonatype
  • Loading branch information
besidev committed Oct 30, 2024
1 parent 1ddfe1b commit c4be5bf
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 13 deletions.
49 changes: 36 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ buildscript {
classpath "org.openjfx:javafx-plugin:$JAVAFX_PLUGIN_VERSION"
classpath "one.jpro:jpro-gradle-plugin:$JPRO_VERSION"
classpath "org.owasp:dependency-check-gradle:$DEPENDENCY_CHECK_PLUGIN_VERSION"
classpath "tech.yanand.gradle:maven-central-publish:$MAVEN_CENTRAL_PUBLISH_PLUGIN_VERSION"
}
}

Expand Down Expand Up @@ -85,24 +86,21 @@ configure([project("tree-showing"), project("jpro-auth:core"), project("jpro-aut
project("jpro-routing:dev"), project("jpro-routing:popup"), project("jpro-webrtc"), project("jpro-youtube"),
project("internal:openlink"), project("internal:util")]) {
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'tech.yanand.maven-central-publish'

// Check if the parent of the current project is a subproject
def isParentASubproject = project.parent != null && project.parent != rootProject

publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'one.jpro.platform'
artifactId = isParentASubproject ? "${project.parent.name}-${project.name}" : "${project.name}"
version = JPRO_PLATFORM_VERSION

// Ensure only one component is included in the publication
from components.java
groupId "one.jpro.platform"
version JPRO_PLATFORM_VERSION

def projectParentPathname = project.projectDir.parent
if (projectParentPathname.contains('jpro-auth')) {
artifactId "jpro-auth-" + project.name
} else if (projectParentPathname.contains('jpro-routing')) {
artifactId "jpro-routing-" + project.name
} else if (projectParentPathname.contains('internal')) {
artifactId "jpro-internal-" + project.name
} else {
artifactId project.name
}

pom {
licenses {
Expand All @@ -117,6 +115,11 @@ configure([project("tree-showing"), project("jpro-auth:core"), project("jpro-aut
developerConnection = 'scm:git:https://github.com/JPro-one/jpro-platform.git'
url = "https://github.com/JPro-one/jpro-platform/tree/main/$project.name"
}

issueManagement {
system = 'GitHub'
url = 'https://github.com/JPro-one/JPro-Platform/issues'
}
}
}
}
Expand All @@ -135,6 +138,26 @@ configure([project("tree-showing"), project("jpro-auth:core"), project("jpro-aut
password System.getenv("SANDEC_ARTIFACTORY_PASSWORD")
}
}
maven {
name = 'publish-bundle'
url = layout.buildDirectory.dir('publish-bundle')
}
}
}

signing {
useInMemoryPgpKeys (
System.getenv("SANDEC_SIGNING_KEY_ID"),
System.getenv("SANDEC_SIGNING_SECRET_KEY"),
System.getenv("SANDEC_SIGNING_PASSWORD")
)

sign publishing.publications.mavenJava
}

mavenCentral {
repoDir = layout.buildDirectory.dir('publish-bundle')
authToken = System.getenv("MAVEN_CENTRAL_AUTH_TOKEN")
publishingType = System.getenv("MAVEN_CENTRAL_PUBLISHING_TYPE") ?: 'USER_MANAGED'
}
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ MODULE_PLUGIN_VERSION = 1.8.15
OSDETECTOR_PLUGIN_VERSION = 1.7.3
ENSEMBLE_GRADLE_PLUGIN_VERSION = 0.1.0-SNAPSHOT
DEPENDENCY_CHECK_PLUGIN_VERSION = 9.1.0
MAVEN_CENTRAL_PUBLISH_PLUGIN_VERSION=1.2.0

JAVACPP_VERSION = 1.5.10
JAVACV_VERSION = 1.5.10
Expand Down

0 comments on commit c4be5bf

Please sign in to comment.