diff --git a/build.gradle b/build.gradle index 7bf2a74..f9e976b 100644 --- a/build.gradle +++ b/build.gradle @@ -87,8 +87,6 @@ allprojects { ] } - apply from: "${rootProject.projectDir}/publish-maven.gradle" - if (project.hasProperty('platformVersion')) { apply plugin: 'spring-io' @@ -109,6 +107,13 @@ allprojects { } } +configure(allprojects - [project(':spring-credhub-docs'), + project(':spring-credhub-integration-tests'), + project(':spring-credhub-reactive-integration-tests')]) { + apply plugin: 'java-library' + apply from: "${rootProject.projectDir}/publish-maven.gradle" +} + subprojects { sourceCompatibility = 1.8 targetCompatibility = 1.8 diff --git a/publish-maven.gradle b/publish-maven.gradle index 8b8ecd0..7247368 100644 --- a/publish-maven.gradle +++ b/publish-maven.gradle @@ -14,60 +14,65 @@ * limitations under the License. */ -apply plugin: 'maven' +apply plugin: 'maven-publish' -install { - repositories.mavenInstaller { - customizePom(pom, project) +publishing { + repositories { + maven { + url = project.properties.getOrDefault('publicationRepository', "${System.getenv('HOME')}/.m2/repository") + } } -} - -def customizePom(pom, gradleProject) { - pom.whenConfigured { generatedPom -> - // eliminate test-scoped dependencies (no need in maven central poms) - generatedPom.dependencies.removeAll { dep -> - dep.scope == 'test' - } - - // Ensure consistent ordering of dependencies to ease comparison with older poms - generatedPom.dependencies = generatedPom.dependencies.sort { dep -> - "$dep.scope:$dep.groupId:$dep.artifactId" - } - - // add all items necessary for maven central publication - generatedPom.project { - name = gradleProject.description - description = gradleProject.description - url = 'https://spring.io/projects/spring-credhub' - organization { - name = 'Spring IO' - url = 'https://spring.io' - } - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'https://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' + publications { + mavenJava(MavenPublication) { +// suppressAllPomMetadataWarnings() + from components.java + pom { + afterEvaluate { + name = project.description + description = project.description + } + url = "https://spring.io/projects/spring-credhub" + organization { + name = "Pivotal Software, Inc." + url = "https://spring.io" + } + licenses { + license { + name = "The Apache Software License, Version 2.0" + url = "https://www.apache.org/licenses/LICENSE-2.0.txt" + distribution = "repo" + } + } + scm { + url = "https://github.com/spring-projects/spring-credhub" + connection = "scm:git:git://github.com/spring-projects/spring-credhub" + developerConnection = "scm:git:git://github.com/spring-projects/spring-credhub" + } + issueManagement { + system = "GitHub" + url = "https://github.com/spring-projects/spring-credhub/issues" + } + developers { + developer { + id = "sfrederick" + name = "Scott Frederick" + email = "sfrederick@pivotal.io" + } } } - scm { - url = 'https://github.com/spring-projects/spring-credhub' - connection = 'scm:git:https://github.com/spring-projects/spring-credhub.git' - developerConnection = 'scm:git:https://github.com/spring-projects/spring-credhub.git' - } - - issueManagement { - system = 'GitHub' - url = 'https://github.com/spring-projects/spring-credhub/issues' - } - - developers { - developer { - id = 'sfrederick' - name = 'Scott Frederick' - email = 'sfrederick@pivotal.io' + // Published pom will use fully-qualified dependency versions and no BOMs + versionMapping { + usage('java-api') { + fromResolutionOf('runtimeClasspath') } + usage('java-runtime') { + fromResolutionResult() + } + } + pom.withXml { + def dependencyManagementNode = asNode().get("dependencyManagement") + asNode().remove(dependencyManagementNode) } } }