Improve contents of generated pom files
Previously, the generated pom files were uncustomised and relied on Gradle’s default output. Such pom files are problematic for a couple of reasons: they include test dependencies and they don’t include the metadata that’s required for publishing to Maven Central. This commit customises the generated pom files to include the required metadata and to remove any test dependencies.
This commit is contained in:
@@ -47,6 +47,7 @@ subprojects {
|
||||
apply plugin: 'propdeps-eclipse'
|
||||
apply plugin: 'propdeps-maven'
|
||||
apply plugin: 'maven'
|
||||
apply from: "${rootProject.projectDir}/gradle/publish-maven.gradle"
|
||||
|
||||
sourceCompatibility = 1.7
|
||||
targetCompatibility = 1.7
|
||||
|
||||
45
gradle/publish-maven.gradle
Normal file
45
gradle/publish-maven.gradle
Normal file
@@ -0,0 +1,45 @@
|
||||
install {
|
||||
repositories.mavenInstaller {
|
||||
customizePom(pom, project)
|
||||
}
|
||||
}
|
||||
|
||||
def customizePom(pom, gradleProject) {
|
||||
pom.whenConfigured { generatedPom ->
|
||||
generatedPom.dependencies.removeAll { dep ->
|
||||
dep.scope == "test"
|
||||
}
|
||||
generatedPom.project {
|
||||
name = gradleProject.description
|
||||
description = gradleProject.description
|
||||
url = "https://github.com/spring-projects/spring-restdocs"
|
||||
organization {
|
||||
name = "Spring IO"
|
||||
url = "http://projects.spring.io/spring-restdocs"
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name "The Apache Software License, Version 2.0"
|
||||
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
distribution "repo"
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url = "https://github.com/spring-projects/spring-restdocs"
|
||||
connection = "scm:git:git://github.com/spring-projects/spring-restdocs"
|
||||
developerConnection = "scm:git:git://github.com/spring-projects/spring-restdocs"
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id = "awilkinson"
|
||||
name = "Andy Wilkinson"
|
||||
email = "awilkinson@pivotal.io"
|
||||
}
|
||||
}
|
||||
issueManagement {
|
||||
system = "GitHub"
|
||||
url = "https://github.com/spring-projects/spring-restdocs/issues"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user