mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
gradle: Switch to 'maven-publish' plugin
This commit is contained in:
parent
f2e1d7ddd5
commit
89cb3f679b
2 changed files with 57 additions and 82 deletions
|
@ -36,7 +36,7 @@ install: gradle assemble --stacktrace
|
||||||
# functional. Which hasn't always be the case in the past, see
|
# functional. Which hasn't always be the case in the past, see
|
||||||
# 90cbcaebc7a89f4f771f733a33ac9f389df85be2
|
# 90cbcaebc7a89f4f771f733a33ac9f389df85be2
|
||||||
# Also run javadocAll to ensure it works.
|
# Also run javadocAll to ensure it works.
|
||||||
script: gradle check install javadocAll --stacktrace
|
script: gradle check publishToMavenLocal javadocAll --stacktrace
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- JAVAC_VERSION=$((javac -version) 2>&1)
|
- JAVAC_VERSION=$((javac -version) 2>&1)
|
||||||
|
|
137
build.gradle
137
build.gradle
|
@ -1,5 +1,3 @@
|
||||||
import org.gradle.plugins.signing.Sign
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
|
@ -38,7 +36,8 @@ allprojects {
|
||||||
rootConfigDir = new File(rootDir, 'config')
|
rootConfigDir = new File(rootDir, 'config')
|
||||||
sonatypeCredentialsAvailable = project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')
|
sonatypeCredentialsAvailable = project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')
|
||||||
isReleaseVersion = !isSnapshot
|
isReleaseVersion = !isSnapshot
|
||||||
signingRequired = isReleaseVersion
|
isContinuousIntegrationEnvironment = Boolean.parseBoolean(System.getenv('CI'))
|
||||||
|
signingRequired = !(isSnapshot || isContinuousIntegrationEnvironment)
|
||||||
sonatypeSnapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
|
sonatypeSnapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
|
||||||
sonatypeStagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
|
sonatypeStagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
|
||||||
// Returns only the date in yyyy-MM-dd format, as otherwise, with
|
// Returns only the date in yyyy-MM-dd format, as otherwise, with
|
||||||
|
@ -387,7 +386,7 @@ ${oneLineDesc}."""
|
||||||
|
|
||||||
evaluationDependsOnChildren()
|
evaluationDependsOnChildren()
|
||||||
subprojects {
|
subprojects {
|
||||||
apply plugin: 'maven'
|
apply plugin: 'maven-publish'
|
||||||
apply plugin: 'signing'
|
apply plugin: 'signing'
|
||||||
apply plugin: 'checkstyle'
|
apply plugin: 'checkstyle'
|
||||||
apply plugin: 'org.kordamp.gradle.clirr'
|
apply plugin: 'org.kordamp.gradle.clirr'
|
||||||
|
@ -403,89 +402,66 @@ subprojects {
|
||||||
classifier = 'javadoc'
|
classifier = 'javadoc'
|
||||||
from javadoc.destinationDir
|
from javadoc.destinationDir
|
||||||
}
|
}
|
||||||
task testJar(type: Jar, dependsOn: testClasses) {
|
task testsJar(type: Jar, dependsOn: testClasses) {
|
||||||
classifier = 'tests'
|
classifier = 'tests'
|
||||||
from sourceSets.test.output
|
from sourceSets.test.output
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does install unique snapshosts (and release)s in the local maven
|
|
||||||
// repository, unlike the 'install' task.
|
|
||||||
// You can specify the path of the local maven repository using 'maven.repo.local', e.g.
|
|
||||||
// gradle uploadLocal -Dmaven.repo.local=/var/www/repo
|
|
||||||
task uploadLocal(type: Upload) {
|
|
||||||
description "Uploads artifacts into the local maven repositories URL."
|
|
||||||
configuration = configurations['archives']
|
|
||||||
repositories {
|
|
||||||
mavenDeployer {
|
|
||||||
repository url: repositories.mavenLocal().url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
archivesOutput.extendsFrom (testCompile)
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
|
// TODO delete those?
|
||||||
archives sourcesJar
|
archives sourcesJar
|
||||||
archives javadocJar
|
archives javadocJar
|
||||||
archives testJar
|
archives testsJar
|
||||||
// See http://stackoverflow.com/a/21946676/194894
|
// See http://stackoverflow.com/a/21946676/194894
|
||||||
testRuntime testJar
|
testRuntime testsJar
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadArchives {
|
publishing {
|
||||||
repositories {
|
publications {
|
||||||
mavenDeployer {
|
mavenJava(MavenPublication) {
|
||||||
if (signingRequired) {
|
from components.java
|
||||||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
artifact sourcesJar
|
||||||
}
|
artifact javadocJar
|
||||||
repository(url: project.sonatypeStagingUrl) {
|
artifact testsJar
|
||||||
if (sonatypeCredentialsAvailable) {
|
pom {
|
||||||
authentication(userName: sonatypeUsername, password: sonatypePassword)
|
name = 'Smack'
|
||||||
}
|
packaging = 'jar'
|
||||||
}
|
inceptionYear = '2003'
|
||||||
snapshotRepository(url: project.sonatypeSnapshotUrl) {
|
url = 'http://www.igniterealtime.org/projects/smack/'
|
||||||
if (sonatypeCredentialsAvailable) {
|
|
||||||
authentication(userName: sonatypeUsername, password: sonatypePassword)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pom.project {
|
|
||||||
name 'Smack'
|
|
||||||
packaging 'jar'
|
|
||||||
inceptionYear '2003'
|
|
||||||
url 'http://www.igniterealtime.org/projects/smack/'
|
|
||||||
description project.description
|
description project.description
|
||||||
|
|
||||||
issueManagement {
|
issueManagement {
|
||||||
system 'JIRA'
|
system = 'JIRA'
|
||||||
url 'https://igniterealtime.org/issues/browse/SMACK'
|
url = 'https://igniterealtime.org/issues/browse/SMACK'
|
||||||
}
|
|
||||||
|
|
||||||
distributionManagement {
|
|
||||||
snapshotRepository {
|
|
||||||
id 'smack.snapshot'
|
|
||||||
url project.sonatypeSnapshotUrl
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scm {
|
scm {
|
||||||
url 'https://github.com/igniterealtime/Smack'
|
url = 'https://github.com/igniterealtime/Smack'
|
||||||
connection 'scm:git:https://github.com/igniterealtime/Smack.git'
|
connection = 'scm:git:https://github.com/igniterealtime/Smack.git'
|
||||||
developerConnection 'scm:git:https://github.com/igniterealtime/Smack.git'
|
developerConnection = 'scm:git:https://github.com/igniterealtime/Smack.git'
|
||||||
}
|
}
|
||||||
|
|
||||||
developers {
|
developers {
|
||||||
developer {
|
developer {
|
||||||
id 'flow'
|
id = 'flow'
|
||||||
name 'Florian Schmaus'
|
name = 'Florian Schmaus'
|
||||||
email 'flow@igniterealtime.org'
|
email = 'flow@igniterealtime.org'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url isSnapshot ? sonatypeSnapshotUrl : sonatypeStagingUrl
|
||||||
|
if (sonatypeCredentialsAvailable) {
|
||||||
|
credentials {
|
||||||
|
username = sonatypeUsername
|
||||||
|
password = sonatypePassword
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rootProject.distributionZip {
|
rootProject.distributionZip {
|
||||||
dependsOn build
|
dependsOn build
|
||||||
|
@ -507,7 +483,7 @@ subprojects {
|
||||||
signing {
|
signing {
|
||||||
useGpgCmd()
|
useGpgCmd()
|
||||||
required { signingRequired }
|
required { signingRequired }
|
||||||
sign configurations.archives
|
sign publishing.publications.mavenJava
|
||||||
}
|
}
|
||||||
|
|
||||||
clirr {
|
clirr {
|
||||||
|
@ -589,15 +565,15 @@ configure(subprojects - gplLicensedProjects) {
|
||||||
checkstyle {
|
checkstyle {
|
||||||
configProperties.checkstyleLicenseHeader = "header"
|
configProperties.checkstyleLicenseHeader = "header"
|
||||||
}
|
}
|
||||||
uploadArchives {
|
publishing {
|
||||||
repositories {
|
publications {
|
||||||
mavenDeployer {
|
mavenJava(MavenPublication) {
|
||||||
pom.project {
|
pom {
|
||||||
licenses {
|
licenses {
|
||||||
license {
|
license {
|
||||||
name 'The Apache Software License, Version 2.0'
|
name = 'The Apache Software License, Version 2.0'
|
||||||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||||
distribution 'repo'
|
distribution = 'repo'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -610,15 +586,16 @@ configure(gplLicensedProjects) {
|
||||||
checkstyle {
|
checkstyle {
|
||||||
configProperties.checkstyleLicenseHeader = "${project.name}-gplv3-license-header"
|
configProperties.checkstyleLicenseHeader = "${project.name}-gplv3-license-header"
|
||||||
}
|
}
|
||||||
uploadArchives {
|
publishing {
|
||||||
repositories {
|
publications {
|
||||||
mavenDeployer {
|
mavenJava(MavenPublication) {
|
||||||
pom.project {
|
pom {
|
||||||
licenses {
|
licenses {
|
||||||
license {
|
license {
|
||||||
name 'GNU General Public License, version 3 or any later version'
|
name = 'GNU General Public License, version 3 or any later version'
|
||||||
url 'https://www.gnu.org/licenses/gpl.txt'
|
url = 'https://www.gnu.org/licenses/gpl.txt'
|
||||||
distribution 'repo'
|
distribution = 'repo'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -626,8 +603,6 @@ configure(gplLicensedProjects) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
configure(androidBootClasspathProjects) {
|
configure(androidBootClasspathProjects) {
|
||||||
compileJava {
|
compileJava {
|
||||||
options.bootstrapClasspath = files(androidBootClasspath)
|
options.bootstrapClasspath = files(androidBootClasspath)
|
||||||
|
|
Loading…
Reference in a new issue