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:
Andy Wilkinson
2015-09-03 15:07:59 +01:00
parent 7235a49dbc
commit 51051de4c4
2 changed files with 46 additions and 0 deletions

View File

@@ -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

View 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"
}
}
}
}