mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-22 20:32:05 +01:00
Merge pull request #10 from Flowdalic/maven-publish
gradle: switch to 'maven-publish' plugin for artifact publication
This commit is contained in:
commit
611b105843
1 changed files with 37 additions and 40 deletions
77
build.gradle
77
build.gradle
|
@ -58,8 +58,9 @@ allprojects {
|
||||||
rootConfigDir = new File(rootDir, 'config')
|
rootConfigDir = new File(rootDir, 'config')
|
||||||
gitCommit = getGitCommit()
|
gitCommit = getGitCommit()
|
||||||
builtDate = (new SimpleDateFormat("yyyy-MM-dd")).format(new Date())
|
builtDate = (new SimpleDateFormat("yyyy-MM-dd")).format(new Date())
|
||||||
|
isContinuousIntegrationEnvironment = Boolean.parseBoolean(System.getenv('CI'))
|
||||||
isReleaseVersion = !isSnapshot
|
isReleaseVersion = !isSnapshot
|
||||||
signingRequired = isReleaseVersion
|
signingRequired = !(isSnapshot || isContinuousIntegrationEnvironment)
|
||||||
sonatypeCredentialsAvailable = project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')
|
sonatypeCredentialsAvailable = project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')
|
||||||
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'
|
||||||
|
@ -94,7 +95,7 @@ allprojects {
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
apply plugin: 'maven'
|
apply plugin: 'maven-publish'
|
||||||
apply plugin: 'signing'
|
apply plugin: 'signing'
|
||||||
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
|
@ -105,69 +106,65 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
publishing {
|
||||||
archives sourcesJar
|
publications {
|
||||||
archives javadocJar
|
mavenJava(MavenPublication) {
|
||||||
archives testJar
|
from components.java
|
||||||
}
|
artifact sourcesJar
|
||||||
|
artifact javadocJar
|
||||||
uploadArchives {
|
artifact testsJar
|
||||||
repositories {
|
pom {
|
||||||
mavenDeployer {
|
name = 'PGPainless'
|
||||||
if (signingRequired) {
|
|
||||||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
|
||||||
}
|
|
||||||
repository(url: project.sonatypeStagingUrl) {
|
|
||||||
if (sonatypeCredentialsAvailable) {
|
|
||||||
authentication(userName: sonatypeUsername, password: sonatypePassword)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
snapshotRepository(url: project.sonatypeSnapshotUrl) {
|
|
||||||
if (sonatypeCredentialsAvailable) {
|
|
||||||
authentication(userName: sonatypeUsername, password: sonatypePassword)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pom.project {
|
|
||||||
name 'PGPainless'
|
|
||||||
description 'Simple to use OpenPGP API for Java based on Bouncycastle'
|
description 'Simple to use OpenPGP API for Java based on Bouncycastle'
|
||||||
url 'https://github.com/pgpainless/pgpainless'
|
url = 'https://github.com/pgpainless/pgpainless'
|
||||||
inceptionYear '2018'
|
inceptionYear = '2018'
|
||||||
|
|
||||||
scm {
|
scm {
|
||||||
url 'https://github.com/pgpainless/pgpainless'
|
url = 'https://github.com/pgpainless/pgpainless'
|
||||||
connection 'scm:https://github.com/pgpainless/pgpainless'
|
connection = 'scm:https://github.com/pgpainless/pgpainless'
|
||||||
developerConnection 'scm:git://github.com/pgpainless/pgpainless.git'
|
developerConnection = 'scm:git://github.com/pgpainless/pgpainless.git'
|
||||||
}
|
}
|
||||||
|
|
||||||
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'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
developers {
|
developers {
|
||||||
developer {
|
developer {
|
||||||
id 'vanitasvitae'
|
id = 'vanitasvitae'
|
||||||
name 'Paul Schaub'
|
name = 'Paul Schaub'
|
||||||
email 'vanitasvitae@fsfe.org'
|
email = 'vanitasvitae@fsfe.org'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
repositories {
|
||||||
|
if (sonatypeCredentialsAvailable) {
|
||||||
|
maven {
|
||||||
|
url isSnapshot ? sonatypeSnapshotUrl : sonatypeStagingUrl
|
||||||
|
credentials {
|
||||||
|
username = sonatypeUsername
|
||||||
|
password = sonatypePassword
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signing {
|
signing {
|
||||||
|
useGpgCmd()
|
||||||
required { signingRequired }
|
required { signingRequired }
|
||||||
sign configurations.archives
|
sign publishing.publications.mavenJava
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue