Gradle
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
apply plugin: 'maven-publish'
|
||||
// We'll sign with Maven
|
||||
// This setup seems to work. Let's not touch it.
|
||||
|
||||
apply plugin: 'maven'
|
||||
//apply plugin: 'signing'
|
||||
|
||||
publish.dependsOn(check)
|
||||
uploadArchives.dependsOn { [check] }
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
task sourcesJar(type: Jar) {
|
||||
classifier 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
task groovydocJar(type: Jar, dependsOn: groovydoc) {
|
||||
@@ -14,7 +15,16 @@ task groovydocJar(type: Jar, dependsOn: groovydoc) {
|
||||
from groovydoc.destinationDir
|
||||
}
|
||||
|
||||
assemble.dependsOn(groovydocJar)
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
classifier 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
archives groovydocJar
|
||||
archives javadocJar
|
||||
}
|
||||
|
||||
ext {
|
||||
resolveRepoName = { Project project ->
|
||||
@@ -42,71 +52,10 @@ ext {
|
||||
repoUrl = isReleaseToCentral ?
|
||||
"https://oss.sonatype.org/service/local/staging/deploy/maven2/" :
|
||||
"https://repo.spring.io/${resolveRepoName(project)}"
|
||||
repoUserName = isReleaseToCentral ? getProp("SONATYPE_USER") : repoUser
|
||||
repoPass = isReleaseToCentral ? getProp("SONATYPE_PASSWORD") : repoPass
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
url = repoUrl
|
||||
credentials {
|
||||
username = repoUserName
|
||||
password = repoPass
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
pluginMaven(MavenPublication) {
|
||||
artifact groovydocJar
|
||||
pom {
|
||||
name = project.name
|
||||
packaging = 'jar'
|
||||
description = 'Spring Cloud Contract Gradle Plugin'
|
||||
url = 'https://github.com/spring-cloud/spring-cloud-contract'
|
||||
inceptionYear = '2014'
|
||||
|
||||
scm {
|
||||
connection = 'scm:git:git@github.com:spring-cloud/spring-cloud-contract.git'
|
||||
developerConnection = 'scm:git:git@github.com:spring-cloud/spring-cloud-contract.git'
|
||||
url = 'https://github.com/spring-cloud/spring-cloud-contract'
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name = 'The Apache License, Version 2.0'
|
||||
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id = 'jkubrynski'
|
||||
name = 'Jakub Kubrynski'
|
||||
email = 'jk ATT codearte DOTT io'
|
||||
}
|
||||
developer {
|
||||
id = 'marcingrzejszczak'
|
||||
name = 'Marcin Grzejszczak'
|
||||
email = 'mgrzejszczak ATT pivotal DOTT io'
|
||||
}
|
||||
developer {
|
||||
id = 'dsyer'
|
||||
name = 'Dave Syer'
|
||||
email = 'dsyer ATT pivotal DOTT io'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isReleaseToCentral) {
|
||||
// We'll sign with Maven
|
||||
/*signing {
|
||||
publishing.publications.each {
|
||||
sign it
|
||||
}
|
||||
sign configurations.archives
|
||||
}*/
|
||||
|
||||
@@ -132,6 +81,65 @@ if (isReleaseToCentral) {
|
||||
}
|
||||
}
|
||||
|
||||
String getProp(String propName) {
|
||||
return (findProperty(propName) ?: System.properties[propName]) ?: System.getenv(propName)
|
||||
afterEvaluate {
|
||||
uploadArchives {
|
||||
repositories {
|
||||
mavenDeployer {
|
||||
// POM signature
|
||||
if (isReleaseVersion && isReleaseToCentral) {
|
||||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
||||
}
|
||||
// Target repository
|
||||
String repoUserName = isReleaseToCentral ? getProp("SONATYPE_USER") : repoUser
|
||||
String repoPass = isReleaseToCentral ? getProp("SONATYPE_PASSWORD") : repoPass
|
||||
repository(url: repoUrl) {
|
||||
authentication(userName: repoUserName, password: repoPass)
|
||||
}
|
||||
pom.project {
|
||||
name "$project.name"
|
||||
packaging 'jar'
|
||||
description 'Spring Cloud Contract Gradle Plugin'
|
||||
url 'https://github.com/spring-cloud/spring-cloud-contract'
|
||||
inceptionYear '2014'
|
||||
|
||||
scm {
|
||||
connection 'scm:git:git@github.com:spring-cloud/spring-cloud-contract.git'
|
||||
developerConnection 'scm:git:git@github.com:spring-cloud/spring-cloud-contract.git'
|
||||
url 'https://github.com/spring-cloud/spring-cloud-contract'
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name 'The Apache License, Version 2.0'
|
||||
url 'https://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id 'jkubrynski'
|
||||
name 'Jakub Kubrynski'
|
||||
email 'jk ATT codearte DOTT io'
|
||||
}
|
||||
developer {
|
||||
id 'marcingrzejszczak'
|
||||
name 'Marcin Grzejszczak'
|
||||
email 'mgrzejszczak ATT pivotal DOTT io'
|
||||
}
|
||||
developer {
|
||||
id 'dsyer'
|
||||
name 'Dave Syer'
|
||||
email 'dsyer ATT pivotal DOTT io'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String getProp(String propName) {
|
||||
return hasProperty(propName) ?
|
||||
(getProperty(propName) ?: System.properties[propName]) : System.properties[propName] ?:
|
||||
System.getenv(propName)
|
||||
}
|
||||
Reference in New Issue
Block a user