-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously releases were performed using the legacy 'maven' plugin. This is hard to configure, so we used the 'nexus' plugin built on top of that. Since then, that plugin inspired the official maven-publish plugin which uses a similar configuration. In Gradle 6 the legacy plugin was deprecated. The output is similar except it now includes a more succinct generated pom (no test scope dependencies) and the new Gradle module metadata. The simulator's application archives (zip and tar) are no longer attached, as they were by default before. Since this is a development tool and there isn't a known use-case for publishing those, until otherwise asked for they are no longer provided.
- Loading branch information
Showing
5 changed files
with
77 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,89 @@ | ||
/** | ||
* Configuration for publishing to Maven Central | ||
*/ | ||
apply plugin: 'com.bmuschko.nexus' | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'java-library' | ||
apply plugin: 'signing' | ||
|
||
if (System.env.'nexusUsername') { | ||
project.nexusUsername = System.env.'nexusUsername' | ||
project.nexusPassword = System.env.'nexusPassword' | ||
configurations { | ||
testArtifacts | ||
} | ||
|
||
extraArchive.tests = true | ||
java { | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
modifyPom { | ||
project { | ||
name 'Caffeine cache' | ||
description 'A high performance caching library for Java 8+' | ||
url 'https://github.com/ben-manes/caffeine' | ||
inceptionYear '2014' | ||
task testJar(type: Jar, group: 'Build') { | ||
description = 'Assembles a jar archive containing the test classes.' | ||
from sourceSets.test.output | ||
archiveClassifier = 'test' | ||
} | ||
|
||
scm { | ||
url 'https://github.com/ben-manes/caffeine' | ||
connection 'scm:https://[email protected]/ben-manes/caffeine.git' | ||
developerConnection 'scm:git://github.com/ben-manes/caffeine.git' | ||
} | ||
artifacts { | ||
testArtifacts testJar | ||
} | ||
|
||
licenses { | ||
license { | ||
name 'Apache License, Version 2.0' | ||
url 'https://www.apache.org/licenses/LICENSE-2.0.txt' | ||
distribution 'repo' | ||
} | ||
} | ||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
artifact testJar | ||
|
||
pom { | ||
name = 'Caffeine cache' | ||
description = 'A high performance caching library' | ||
url = 'https://github.com/ben-manes/caffeine' | ||
inceptionYear = '2014' | ||
|
||
developers { | ||
developer { | ||
id 'ben-manes' | ||
name 'Ben Manes' | ||
email '[email protected]' | ||
roles { | ||
role 'owner' | ||
role 'developer' | ||
scm { | ||
url = 'https://github.com/ben-manes/caffeine' | ||
connection = 'scm:https://[email protected]/ben-manes/caffeine.git' | ||
developerConnection = 'scm:git://github.com/ben-manes/caffeine.git' | ||
} | ||
|
||
licenses { | ||
license { | ||
name = 'Apache License, Version 2.0' | ||
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' | ||
distribution = 'repo' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id = 'ben-manes' | ||
name = 'Ben Manes' | ||
email = '[email protected]' | ||
roles = [ 'owner', 'developer' ] | ||
} | ||
} | ||
} | ||
repositories { | ||
maven { | ||
def releasesUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' | ||
def snapshotsUrl = 'https://oss.sonatype.org/content/repositories/snapshots/' | ||
url = project.version.releaseBuild ? releasesUrl : snapshotsUrl | ||
credentials { | ||
username = project.properties['nexusUsername'] ?: null | ||
password = project.properties['nexusPassword'] ?: null | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
// https://github.com/gradle/gradle/issues/11387 | ||
required { false } | ||
if (version.releaseBuild) { | ||
sign publishing.publications.mavenJava | ||
} | ||
} | ||
|
||
javadoc { | ||
if (JavaVersion.current().isJava9Compatible()) { | ||
options.addBooleanOption('html5', true) | ||
} | ||
} |