Skip to content

Commit 51ae2e4

Browse files
authored
Merge pull request #3181 from akomakom/ci-nexus-publish-plugin
Switch to gradle nexus publish plugin (Daggy master)
2 parents 4f2a10b + 17ed42b commit 51ae2e4

File tree

4 files changed

+23
-50
lines changed

4 files changed

+23
-50
lines changed

build-logic/src/main/java/org/ehcache/build/conventions/DeployConvention.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,6 @@ public void apply(Project project) {
8080
dev.getOrganizationUrl().set("http://ehcache.org");
8181
}));
8282
}));
83-
publishing.repositories(repositories -> repositories.maven(maven -> {
84-
if (IS_RELEASE.test(project)) {
85-
maven.setUrl(project.property("deployUrl"));
86-
maven.credentials(creds -> {
87-
creds.setUsername(project.property("deployUser").toString());
88-
creds.setPassword(project.property("deployPwd").toString());
89-
});
90-
maven.setAllowInsecureProtocol(true);
91-
} else {
92-
maven.setName("sonatype-nexus-snapshot");
93-
maven.setUrl("https://oss.sonatype.org/content/repositories/snapshots");
94-
maven.credentials(creds -> {
95-
creds.setUsername(project.property("sonatypeUser").toString());
96-
creds.setPassword(project.property("sonatypePwd").toString());
97-
});
98-
}
99-
}));
10083
});
10184

10285
project.getExtensions().configure(SigningExtension.class, signing -> {

build.gradle

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
plugins {
1818
// This adds tasks to auto close or release nexus staging repos
19-
// see https://github.com/Codearte/gradle-nexus-staging-plugin/
20-
id 'io.codearte.nexus-staging'
19+
// see https://github.com/gradle-nexus/publish-plugin
20+
id 'io.github.gradle-nexus.publish-plugin'
2121
//OWASP Security Vulnerability Detection
2222
id 'org.owasp.dependencycheck'
2323
}
@@ -30,38 +30,26 @@ allprojects {
3030
version = findProperty('overrideVersion') ?: ehcacheVersion
3131
}
3232

33-
if (deployUrl.contains('nexus')) {
34-
//internal terracotta config, shorten url for this plugin to end at local/
35-
project.nexusStaging {
36-
serverUrl = deployUrl.replaceAll(~/local\/.*$/, "local/")
37-
packageGroup = 'Ehcache OS' //internal staging repository name
33+
nexusPublishing {
34+
repositories {
35+
sonatype {
36+
username = sonatypeUser
37+
password = sonatypePwd
38+
packageGroup = 'org.ehcache' //Sonatype staging repository name
39+
}
40+
nexus {
41+
username = tcDeployUser
42+
password = tcDeployPassword
43+
packageGroup = 'Ehcache OS' //internal staging repository name
44+
nexusUrl.set(uri('https://nexus.terracotta.eur.ad.sag:8443/service/local/'))
45+
snapshotRepositoryUrl.set(uri("https://nexus.terracotta.eur.ad.sag:8443/content/repositories/terracotta-os-snapshots/"))
46+
}
3847
}
39-
ext {
40-
deployUser = tcDeployUser
41-
deployPwd = tcDeployPassword
42-
}
43-
} else {
44-
project.nexusStaging {
45-
packageGroup = 'org.ehcache' //Sonatype staging repository name
46-
}
47-
ext {
48-
deployUser = sonatypeUser
49-
deployPwd = sonatypePwd
50-
}
51-
}
52-
53-
nexusStaging {
54-
username = project.ext.deployUser
55-
password = project.ext.deployPwd
56-
logger.debug("Nexus Staging: Using login ${username} and url ${serverUrl}")
5748
// Sonatype is often very slow in these operations:
58-
delayBetweenRetriesInMillis = (findProperty('delayBetweenRetriesInMillis') ?: '10000') as int
59-
numberOfRetries = (findProperty('numberOfRetries') ?: '100') as int
60-
}
61-
62-
tasks.named('closeAndReleaseRepository') {
63-
// Disable automatic promotion for added safety
64-
enabled = false;
49+
transitionCheckOptions {
50+
delayBetween = Duration.ofSeconds((findProperty('delayBetweenRetriesInSeconds') ?: '10') as int)
51+
maxRetries = (findProperty('numberOfRetries') ?: '100') as int
52+
}
6553
}
6654

6755
assert (JavaVersion.current().isJava8Compatible()) : 'The Ehcache 3 build requires Java 8+ to run'

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jcacheTckVersion = 1.1.0
2424

2525
sonatypeUser = OVERRIDE_ME
2626
sonatypePwd = OVERRIDE_ME
27+
tcDeployUser = OVERRIDE_ME
28+
tcDeployPassword = OVERRIDE_ME
2729

2830
deployUrl = https://oss.sonatype.org/service/local/staging/deploy/maven2/
2931

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
pluginManagement {
1818
plugins {
19-
id 'io.codearte.nexus-staging' version '0.30.0'
19+
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
2020
id 'org.owasp.dependencycheck' version '7.1.0.1'
2121
id 'org.gretty' version '3.0.6'
2222
id 'org.asciidoctor.jvm.base' version '3.3.2'

0 commit comments

Comments
 (0)