From 7fe25b745bd421fc6e317ea1ec0146c375a20a2c Mon Sep 17 00:00:00 2001 From: James Daugherty Date: Wed, 20 Nov 2024 15:02:43 -0500 Subject: [PATCH] Update to use new grails publish plugins --- build.gradle | 26 ++++-- gradle.properties | 3 +- gradle/publishing.gradle | 89 ------------------- .../gradle.properties | 1 + 4 files changed, 20 insertions(+), 99 deletions(-) delete mode 100644 gradle/publishing.gradle create mode 100644 spring-security-rest-testapp-profile/gradle.properties diff --git a/build.gradle b/build.gradle index 2ca1fa12..73ad423e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,14 @@ import io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository +import org.grails.gradle.plugin.publishing.RepositoryType buildscript { repositories { + mavenLocal() maven { url "https://plugins.gradle.org/m2/" } maven { url "https://repo.grails.org/grails/core" } } dependencies { classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion" - classpath "io.github.gradle-nexus:publish-plugin:$gradlePublishPlugin" classpath 'com.adarshr:gradle-test-logger-plugin:4.0.0' classpath 'io.spring.gradle:dependency-management-plugin' } @@ -15,7 +16,6 @@ buildscript { plugins { id 'idea' - id 'io.github.gradle-nexus.publish-plugin' version "$gradlePublishPlugin" id "com.github.ben-manes.versions" version "0.51.0" } @@ -57,6 +57,7 @@ subprojects { Project project -> ext.set('isProfile', project.name.endsWith('-profile')) repositories { + mavenLocal() mavenCentral() maven { url "https://repo.grails.org/grails/core" } } @@ -103,21 +104,28 @@ subprojects { Project project -> showSkippedStandardStreams false showFailedStandardStreams true } + + apply plugin: "org.grails.grails-publish" } if (project.name in profileProjects) { apply plugin: "org.grails.grails-profile" apply plugin: "io.spring.dependency-management" + apply plugin: "org.grails.grails-profile-publish" } - if (project.name in publishedProjects) { - apply from: rootProject.file("gradle/publishing.gradle") + if(project.name in publishedProjects) { + grailsPublish { + license { + name = 'Apache-2.0' + } + githubSlug = 'grails/grails-spring-security-rest' + title = "Spring Security REST plugin" + desc = "Grails plugin to implement token-based, RESTful authentication using Spring Security" + developers = [alvarosanchez:"Alvaro Sanchez-Mariscal", jameskleeh: "James Kleeh", jdaugherty: "James Daugherty"] + snapshotRepoType = RepositoryType.ARTIFACTORY + } } } apply from: rootProject.file("gradle/docs.gradle") - -//do not generate extra load on Nexus with new staging repository if signing fails -tasks.withType(InitializeNexusStagingRepository).configureEach { - shouldRunAfter(tasks.withType(Sign)) -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 16e6e524..d0bf91f4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,4 +4,5 @@ grailsGradlePluginVersion=7.0.0-SNAPSHOT gradlePublishPlugin=2.0.0 springSecurityCoreVersion=7.0.0-SNAPSHOT pac4jVersion=6.0.6 -jackson.version=2.18.0 \ No newline at end of file +jackson.version=2.18.0 +artifactoryPublishUrl=https://repo.grails.org/grails/libs-snapshots-local \ No newline at end of file diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle deleted file mode 100644 index 9bbf113a..00000000 --- a/gradle/publishing.gradle +++ /dev/null @@ -1,89 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'signing' - -ext.set('signing.keyId', project.findProperty('signing.keyId') ?: System.getenv('SIGNING_KEY')) -ext.set('signing.password', project.findProperty('signing.password') ?: System.getenv('SIGNING_PASSPHRASE')) - -def pomInfo = { - delegate.name "Spring Security REST plugin" - delegate.description "Grails plugin to implement token-based, RESTful authentication using Spring Security" - delegate.url "https://github.com/grails/grails-spring-security-rest" - - delegate.licenses { - delegate.license { - delegate.name 'Apache-2.0' - delegate.url 'https://www.apache.org/licenses/LICENSE-2.0.txt' - delegate.distribution 'repo' - } - } - - delegate.scm { - delegate.url "scm:git@github.com:grails/grails-spring-security-rest.git" - delegate.connection "scm:git@github.com:grails/grails-spring-security-rest.git" - delegate.developerConnection "scm:git@github.com:grails/grails-spring-security-rest.git" - } - - delegate.developers { - delegate.developer { - delegate.id 'alvarosanchez' - delegate.name 'Alvaro Sanchez-Mariscal' - } - delegate.developer { - delegate.id 'jameskleeh' - delegate.name 'James Kleeh' - } - delegate.developer { - delegate.id 'jdaugherty' - delegate.name "James Daugherty" - } - } -} - -publishing { - publications { - maven(MavenPublication) { - artifactId = project.name - groupId = project.group - version = project.version - - if(!isProfile) { - from components.java - - artifact sourcesJar - artifact javadocJar - } - - pom.withXml { - def pomNode = asNode() - pomNode.children().last() + pomInfo - } - } - } - - if (isSnapshot) { - repositories { - maven { - credentials { - username = project.findProperty('artifactoryPublishUsername') ?: '' - password = project.findProperty('artifactoryPublishPassword') ?: '' - } - url = isProfile ? - uri('https://repo.grails.org/grails/libs-snapshots-local') : - uri('https://repo.grails.org/grails/plugins3-snapshots-local') - - - } - } - } -} - -afterEvaluate { - signing { - required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') } - sign(publishing.publications.maven) - } -} - -tasks.withType(Sign) { - onlyIf { isReleaseVersion } -} diff --git a/spring-security-rest-testapp-profile/gradle.properties b/spring-security-rest-testapp-profile/gradle.properties new file mode 100644 index 00000000..a4c724b8 --- /dev/null +++ b/spring-security-rest-testapp-profile/gradle.properties @@ -0,0 +1 @@ +artifactoryPublishUrl=https://repo.grails.org/grails/plugins3-snapshots-local \ No newline at end of file