diff --git a/build.gradle b/build.gradle
index 0ae84bd9c4..6488efeafb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -9,9 +9,13 @@ repositories {
mavenCentral()
}
-apply from: rootProject.file('gradle/java-publish.gradle')
-apply from: rootProject.file('gradle/changelog.gradle')
allprojects {
+ if (findProject('POM_ARTIFACT_ID') != null) {
+ group = getProperty('GROUP')
+ description = getProperty('POM_DESCRIPTION')
+ ext.artifactId = getProperty('POM_ARTIFACT_ID')
+ }
+
apply from: rootProject.file('gradle/spotless.gradle')
}
apply from: rootProject.file('gradle/spotless-freshmark.gradle')
diff --git a/gradle.properties b/gradle.properties
index af21c73045..d9bcf500c8 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -4,20 +4,26 @@ org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true
-name=spotless
-description=Spotless - keep your code spotless with Gradle
-org=diffplug
+GROUP=com.diffplug.spotless
-group=com.diffplug.spotless
+SONATYPE_AUTOMATIC_RELEASE=true
+SONATYPE_HOST=DEFAULT
+RELEASE_SIGNING_ENABLED=true
-artifactIdLib=spotless-lib
-artifactIdLibExtra=spotless-lib-extra
-artifactIdTestLib=spotless-testlib
+POM_URL=https://github.com/diffplug/spotless
-# naming convention '-maven-plugin' allows mvn 'spotless:check' instead of 'spotless-plugin-maven:check'
-artifactIdMaven=spotless-maven-plugin
+POM_LICENSE_NAME=The Apache Software License, Version 2.0
+POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
+POM_LICENSE_DIST=repo
+
+POM_SCM_URL=https://github.com/diffplug/spotless
+POM_SCM_CONNECTION=scm:git:git://github.com/diffplug/spotless.git
+POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/diffplug/spotless.git
+
+POM_DEVELOPER_ID=diffplug
+POM_DEVELOPER_NAME=DiffPlug developers
+POM_DEVELOPER_URL=https://github.com/diffplug
-artifactIdGradle=spotless-plugin-gradle
# Build requirements
VER_JAVA=11
diff --git a/gradle/changelog.gradle b/gradle/changelog.gradle
index 61813f9797..f835e690ff 100644
--- a/gradle/changelog.gradle
+++ b/gradle/changelog.gradle
@@ -25,13 +25,7 @@ spotlessChangelog {
tagMessage "${kind} v{{version}}\n\n{{changes}}"
runAfterPush "gh release create ${kind}/{{version}} --title '${releaseTitle} v{{version}}' --notes-from-tag"
- if (kind == 'gradle') {
- forceNextVersion '7.0.0.BETA2'
- } else if (kind == 'maven') {
- forceNextVersion '2.44.0.BETA2'
- } else {
- forceNextVersion '3.0.0.BETA2'
- }
+ forceNextVersion getProperty('VERSION_NAME')
}
if (project == rootProject) {
diff --git a/gradle/java-publish.gradle b/gradle/java-publish.gradle
index d6f0afa5a0..3f2e9bb470 100644
--- a/gradle/java-publish.gradle
+++ b/gradle/java-publish.gradle
@@ -1,40 +1,5 @@
-import java.nio.charset.StandardCharsets
-
-def decode64(String varName) {
- String envValue = System.env[varName]
- if (envValue == null) {
- return ""
- } else {
- return new String(envValue.decodeBase64(), "UTF-8")
- }
-}
-
-if (project.parent == null) {
- group = 'com.diffplug.spotless'
- def pass = System.env['ORG_GRADLE_PROJECT_nexus_pass64']
- if (pass != null) {
- pass = pass.decodeBase64()
- }
- // it's the root project
- apply plugin: 'io.github.gradle-nexus.publish-plugin'
- nexusPublishing {
- repositories {
- sonatype {
- nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
- snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
- username = System.env['ORG_GRADLE_PROJECT_nexus_user']
- password = decode64('ORG_GRADLE_PROJECT_nexus_pass64')
- }
- }
- }
- def initTask = tasks.named('initializeSonatypeStagingRepository')
- allprojects {
- initTask.configure {
- shouldRunAfter(tasks.withType(Sign))
- }
- }
- return
-}
+apply plugin: 'com.vanniktech.maven.publish'
+apply plugin: 'java'
///////////
// MAVEN //
@@ -48,9 +13,6 @@ tasks.named('sourcesJar') {
dependsOn 'jar'
}
-apply plugin: 'maven-publish'
-apply plugin: 'signing'
-
// Where it's possible to name parameters and methods clearly enough
// that javadoc is not necessary, why make the code bigger?
//
@@ -66,7 +28,7 @@ tasks.named('check') {
// use markdown in javadoc
def makeLink = { url, text -> "${text}" }
-def javadocInfo = '
' + makeLink("https://github.com/${org}/${name}", "${group}:${project.ext.artifactId}:${version}") +
+def javadocInfo = '' + makeLink("https://github.com/diffplug/spotless", "${group}:${project.ext.artifactId}:${version}") +
' by ' + makeLink('https://www.diffplug.com', 'DiffPlug') + '
'
String dotdotGradle = project.name.startsWith('eclipse-') ? '../../gradle' : '../gradle'
@@ -88,117 +50,6 @@ javadoc {
options.linksOffline("https://javadoc.io/static/com.diffplug.spotless/spotless-lib-extra/${rootProject.spotlessChangelog.versionLast}", "${dotdotGradle}/javadoc/spotless-lib-extra")
}
-////////////////
-// PUBLISHING //
-////////////////
-final MAVEN_PLUGIN_ARTIFACT_NAME = 'spotless-maven-plugin'
-boolean isExt = project.name.startsWith('eclipse-')
-boolean isPluginMaven = project.ext.artifactId == 'spotless-maven-plugin'
-
-model {
- publishing {
- publications {
- pluginMaven(MavenPublication) {
- if (project.ext.artifactId != 'spotless-plugin-gradle') {
- from components.java
- }
-
- groupId project.group
- artifactId project.ext.artifactId
- version project.version
-
- pom.withXml {
- // add MavenCentral requirements to the POM
- asNode().children().last() + {
- resolveStrategy = Closure.DELEGATE_FIRST
- name project.ext.artifactId
- description project.description
- url "https://github.com/${project.org}/${rootProject.name}"
- scm {
- url "https://github.com/${project.org}/${rootProject.name}"
- connection "scm:git:https://github.com/${project.org}/${rootProject.name}.git"
- developerConnection "scm:git:ssh:git@github.com/${project.org}/${rootProject.name}.git"
- }
- licenses {
- if (isExt) {
- license {
- name 'Eclipse Public License - v 1.0'
- url 'https://www.eclipse.org/legal/epl-v10.html'
- distribution 'repo'
- }
- } else {
- license {
- name 'The Apache Software License, Version 2.0'
- url 'https://www.apache.org/licenses/LICENSE-2.0.txt'
- distribution 'repo'
- }
- }
- }
- if (isPluginMaven) {
- // Maven plugin required Maven 3.1.0+ to run
- prerequisites { maven '3.1.0' }
- }
- developers {
- if (isExt) {
- project.ext.developers.each { extId, extValues ->
- developer {
- id extId
- name extValues['name']
- email extValues['email']
- }
- }
- } else {
- if (isPluginMaven) {
- developer {
- id 'lutovich'
- name 'Konstantin Lutovich'
- email 'konstantin.lutovich@neotechnology.com'
- }
- }
- developer {
- id 'nedtwigg'
- name 'Ned Twigg'
- email 'ned.twigg@diffplug.com'
- }
- }
- }
- }
- }
- }
- }
- }
-}
-
-if (System.env['JITPACK'] == 'true' || version.endsWith('-SNAPSHOT')) {
- signing {
- setRequired(false)
- }
-} else {
- signing {
- String gpg_key = decode64('ORG_GRADLE_PROJECT_gpg_key64')
- useInMemoryPgpKeys(gpg_key, System.env['ORG_GRADLE_PROJECT_gpg_passphrase'])
- sign(publishing.publications)
- }
-
- // find the project with the changelog (this project for plugins, root project for libs)
- def changelogTasks = (tasks.names.contains('changelogBump') ? project : rootProject).tasks
-
- // ensures that nothing will be built if changelogPush will end up failing
- tasks.named('jar').configure {
- dependsOn changelogTasks.named('changelogCheck')
- }
- // ensures that changelog bump and push only happens if the publish was successful
- def thisProj = project
- changelogTasks.named('changelogBump').configure {
- dependsOn ":${thisProj.path}:publishPluginMavenPublicationToSonatypeRepository"
- dependsOn ":closeAndReleaseSonatypeStagingRepository"
- // if we have a Gradle plugin, we need to push it up to the plugin portal too
- if (thisProj.tasks.names.contains('publishPlugins')) {
- dependsOn thisProj.tasks.named('publishPlugins')
- }
- }
-}
-
tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false
reproducibleFileOrder = true
diff --git a/gradle/spotless-freshmark.gradle b/gradle/spotless-freshmark.gradle
index 54623eb05a..75875a6f8c 100644
--- a/gradle/spotless-freshmark.gradle
+++ b/gradle/spotless-freshmark.gradle
@@ -1,5 +1,6 @@
apply plugin: 'com.diffplug.spotless'
+apply plugin: 'com.diffplug.spotless-changelog'
import com.diffplug.gradle.spotless.FreshMarkExtension
diff --git a/lib-extra/build.gradle b/lib-extra/build.gradle
index a21f4a1f66..99b6c75f21 100644
--- a/lib-extra/build.gradle
+++ b/lib-extra/build.gradle
@@ -2,8 +2,7 @@ plugins {
id 'java-library'
id 'dev.equo.p2deps'
}
-ext.artifactId = project.artifactIdLibExtra
-version = rootProject.spotlessChangelog.versionNext
+
apply from: rootProject.file('gradle/java-setup.gradle')
apply from: rootProject.file('gradle/java-publish.gradle')
diff --git a/lib-extra/gradle.properties b/lib-extra/gradle.properties
new file mode 100644
index 0000000000..981ce813f7
--- /dev/null
+++ b/lib-extra/gradle.properties
@@ -0,0 +1,4 @@
+POM_ARTIFACT_ID=spotless-lib-extra
+POM_NAME=Spotless Lib Extra
+POM_DESCRIPTION=Spotless shared lib extra for Gradle plugin and Maven plugin.
+VERSION_NAME=3.0.0.BETA3-SNAPSHOT
diff --git a/lib/build.gradle b/lib/build.gradle
index 930510995e..f2eb9e1d88 100644
--- a/lib/build.gradle
+++ b/lib/build.gradle
@@ -2,8 +2,7 @@ plugins {
id 'java-library'
id 'io.github.davidburstrom.version-compatibility'
}
-ext.artifactId = project.artifactIdLib
-version = rootProject.spotlessChangelog.versionNext
+
apply from: rootProject.file('gradle/java-setup.gradle')
apply from: rootProject.file('gradle/java-publish.gradle')
diff --git a/lib/gradle.properties b/lib/gradle.properties
new file mode 100644
index 0000000000..3db8f78fef
--- /dev/null
+++ b/lib/gradle.properties
@@ -0,0 +1,4 @@
+POM_ARTIFACT_ID=spotless-lib
+POM_NAME=Spotless Lib
+POM_DESCRIPTION=Spotless shared lib for Gradle plugin and Maven plugin.
+VERSION_NAME=3.0.0.BETA3-SNAPSHOT
diff --git a/plugin-gradle/build.gradle b/plugin-gradle/build.gradle
index 4f82f713bf..f3595e3640 100644
--- a/plugin-gradle/build.gradle
+++ b/plugin-gradle/build.gradle
@@ -1,21 +1,15 @@
-apply from: rootProject.file('gradle/changelog.gradle')
-ext.artifactId = project.artifactIdGradle
-version = spotlessChangelog.versionNext
apply plugin: 'java-library'
apply plugin: 'com.gradle.plugin-publish'
apply plugin: 'java-gradle-plugin'
+apply from: rootProject.file('gradle/changelog.gradle')
apply from: rootProject.file('gradle/java-setup.gradle')
apply from: rootProject.file('gradle/spotless-freshmark.gradle')
dependencies {
- if (version.endsWith('-SNAPSHOT') || (rootProject.spotlessChangelog.versionNext == rootProject.spotlessChangelog.versionLast)) {
- api projects.lib
- api projects.libExtra
- } else {
- api "com.diffplug.spotless:spotless-lib:${rootProject.spotlessChangelog.versionLast}"
- api "com.diffplug.spotless:spotless-lib-extra:${rootProject.spotlessChangelog.versionLast}"
- }
+ api projects.lib
+ api projects.libExtra
+
implementation "com.diffplug.durian:durian-core:${VER_DURIAN}"
implementation "com.diffplug.durian:durian-io:${VER_DURIAN}"
implementation "com.diffplug.durian:durian-collect:${VER_DURIAN}"
diff --git a/plugin-gradle/gradle.properties b/plugin-gradle/gradle.properties
new file mode 100644
index 0000000000..c31dea6bd3
--- /dev/null
+++ b/plugin-gradle/gradle.properties
@@ -0,0 +1,4 @@
+POM_ARTIFACT_ID=spotless-plugin-gradle
+POM_NAME=Spotless Gradle Plugin
+POM_DESCRIPTION=Spotless - keep your code spotless with Gradle.
+VERSION_NAME=7.0.0.BETA3-SNAPSHOT
diff --git a/plugin-maven/build.gradle b/plugin-maven/build.gradle
index 9f7a04703b..e47c9677de 100644
--- a/plugin-maven/build.gradle
+++ b/plugin-maven/build.gradle
@@ -7,9 +7,6 @@ plugins {
}
apply from: rootProject.file('gradle/changelog.gradle')
-ext.artifactId = project.artifactIdMaven
-version = spotlessChangelog.versionNext
-
apply from: rootProject.file("gradle/java-setup.gradle")
apply from: rootProject.file('gradle/spotless-freshmark.gradle')
diff --git a/plugin-maven/gradle.properties b/plugin-maven/gradle.properties
new file mode 100644
index 0000000000..ace41d8a3f
--- /dev/null
+++ b/plugin-maven/gradle.properties
@@ -0,0 +1,6 @@
+POM_ARTIFACT_ID=spotless-maven-plugin
+POM_DEVELOPER_ID=lutovich
+POM_DEVELOPER_NAME=Konstantin Lutovich
+POM_NAME=Spotless Maven Plugin
+POM_DESCRIPTION=Spotless - keep your code spotless with Maven.
+VERSION_NAME=2.44.0.BETA3-SNAPSHOT
diff --git a/settings.gradle b/settings.gradle
index f6dc67a448..69a0274cf9 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -9,8 +9,8 @@ plugins {
id 'com.diffplug.spotless' version '7.0.0.BETA2' apply false
// https://plugins.gradle.org/plugin/com.gradle.plugin-publish
id 'com.gradle.plugin-publish' version '1.2.1' apply false
- // https://github.com/gradle-nexus/publish-plugin/releases
- id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' apply false
+ // https://github.com/vanniktech/gradle-maven-publish-plugin/releases
+ id 'com.vanniktech.maven.publish' version '0.29.0' apply false
// https://github.com/spotbugs/spotbugs-gradle-plugin/releases
id 'com.github.spotbugs' version '6.0.20' apply false
// https://github.com/diffplug/spotless-changelog/blob/main/CHANGELOG.md
diff --git a/testlib/build.gradle b/testlib/build.gradle
index 08e735bced..39c5024840 100644
--- a/testlib/build.gradle
+++ b/testlib/build.gradle
@@ -1,8 +1,7 @@
plugins {
id 'java-library'
}
-ext.artifactId = project.artifactIdTestLib
-version = rootProject.spotlessChangelog.versionNext
+
apply from: rootProject.file('gradle/java-setup.gradle')
dependencies {