Skip to content

Commit fc712d5

Browse files
Fix pubishing to the Gradle Plugins portal (#190)
1 parent 8d9a813 commit fc712d5

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

build.gradle

+23-21
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
plugins {
2-
id 'java-gradle-plugin'
3-
id 'maven-publish'
4-
id 'signing'
52
id 'net.researchgate.release' version '3.0.0'
6-
id 'com.gradle.plugin-publish' version '0.21.0'
3+
id 'com.gradle.plugin-publish' version '1.3.0'
74
id 'org.jreleaser' version '1.15.0'
85
}
96

107
apply from: 'gradle/integration-test.gradle'
118

9+
// Plugin publishing configuration
1210
def pluginDescription = 'Scan, evaluate and audit Gradle projects using Sonatype platforms'
11+
def pluginUrl = 'https://github.com/sonatype-nexus-community/scan-gradle-plugin'
1312

1413
gradlePlugin {
1514
plugins {
@@ -18,6 +17,11 @@ gradlePlugin {
1817
implementationClass = 'org.sonatype.gradle.plugins.scan.ScanPlugin'
1918
displayName = project.name
2019
description = pluginDescription
20+
website = pluginUrl
21+
vcsUrl = pluginUrl
22+
tags.set(['sonatype', 'scan', 'dependencies', 'ossindex', 'iq server', 'lifecycle'])
23+
System.setProperty('gradle.publish.key', System.getenv('GRADLE_PUBLISH_KEY') ?: '')
24+
System.setProperty('gradle.publish.secret', System.getenv('GRADLE_PUBLISH_SECRET') ?: '')
2125
}
2226
}
2327
}
@@ -134,24 +138,11 @@ publishing {
134138
}
135139
}
136140

137-
138-
// Plugin publishing configuration
139-
def pluginUrl = 'https://github.com/sonatype-nexus-community/scan-gradle-plugin'
140-
pluginBundle {
141-
website = pluginUrl
142-
vcsUrl = pluginUrl
143-
description = pluginDescription
144-
tags = ['sonatype', 'scan', 'dependencies', 'ossindex', 'iq server']
145-
System.setProperty('gradle.publish.key', System.getenv('GRADLE_PUBLISH_KEY') ?: '')
146-
System.setProperty('gradle.publish.secret', System.getenv('GRADLE_PUBLISH_SECRET') ?: '')
147-
}
148-
149-
150141
jreleaser {
151142
project {
152143
name = 'scan-gradle-plugin'
153-
description = 'Scan, evaluate and audit Gradle projects using Sonatype platforms'
154-
website = 'https://github.com/sonatype-nexus-community/scan-gradle-plugin'
144+
description = pluginDescription
145+
website = pluginUrl
155146
}
156147
signing {
157148
active = 'ALWAYS'
@@ -167,7 +158,6 @@ jreleaser {
167158
if (secretKey) {
168159
System.setProperty('jreleaser.gpg.secret.key', secretKey)
169160
}
170-
171161
}
172162
deploy {
173163
maven {
@@ -183,5 +173,17 @@ jreleaser {
183173
}
184174
}
185175

176+
// Remove unwanted "scan" directory after publishing
177+
tasks.register('cleanupUnwantedArtifacts') {
178+
doLast {
179+
def unwantedDir = file("build/staging-deploy/org/sonatype/gradle/plugins/scan")
180+
if (unwantedDir.exists()) {
181+
println "Removing unwanted directory: $unwantedDir"
182+
delete unwantedDir
183+
}
184+
}
185+
}
186+
186187
afterReleaseBuild.dependsOn publish
187-
// publish.finalizedBy publishPlugins
188+
publish.finalizedBy cleanupUnwantedArtifacts
189+
publish.finalizedBy publishPlugins

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
#
1616

1717
group=org.sonatype.gradle.plugins
18-
version=3.0.0-SNAPSHOT
18+
version=3.0.1-SNAPSHOT
1919
release.useAutomaticVersion=true

0 commit comments

Comments
 (0)