Skip to content

Commit

Permalink
Tweak POM for publishing on Maven Central
Browse files Browse the repository at this point in the history
  • Loading branch information
jskov-jyskebank-dk committed Jan 31, 2018
1 parent 543c82a commit b32fe6a
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 6 deletions.
65 changes: 60 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ defaultTasks 'dist'
ext {
jbNexus = System.getenv('NEXUS_REPO_URL')
publicVersion = version.replaceAll("([V-])0(\\d)", '$1$2').replace("V", "").replace("-", ".")
publishDir = file("dist/publish")
}

if (jbNexus) {
Expand All @@ -28,8 +29,8 @@ repositories {
}

dependencies {
compile 'com.webcohesion.enunciate:enunciate-core:2.10.1'
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.8.9'
compileOnly 'com.webcohesion.enunciate:enunciate-core:2.10.1'
compileOnly 'com.webcohesion.enunciate:enunciate-jaxb:2.10.1'
compileOnly 'com.fasterxml.jackson.core:jackson-databind:2.8.9'
compileOnly 'org.freemarker:freemarker:2.3.23'
Expand Down Expand Up @@ -60,14 +61,37 @@ jar {
include "**/*.ftl"
}
from packSwaggerUi
destinationDir = file("dist/publish")
destinationDir = publishDir

manifest {
attributes(["Implementation-Version" : publicVersion])
}
version = publicVersion
}


task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc
destinationDir = publishDir

manifest {
attributes(["Implementation-Version" : publicVersion])
}
version = publicVersion
classifier = "javadoc"
}

task sourceJar(type: Jar) {
from sourceSets.main.allSource
destinationDir = publishDir

manifest {
attributes(["Implementation-Version" : publicVersion])
}
version = publicVersion
classifier = "sources"
}

test.doFirst {
project.copy {
from 'build/resources/main/META-INF'
Expand Down Expand Up @@ -96,23 +120,54 @@ group 'dk.jyskebank.tooling.enunciate'
publishing {
publications {
mavenJava(MavenPublication) {
pom.withXml {
asNode().with {
appendNode('name', 'enunciate-openapi')
appendNode('description', 'Enunciate module that generates OpenAPI output')
appendNode('url', 'https://github.com/Jyskebank/enunciate-openapi')
appendNode('licenses').with {
appendNode('license').with {
appendNode('name', 'The Apache Software License, Version 2.0')
appendNode('url', 'http://www.apache.org/licenses/LICENSE-2.0.txt')
}
}
appendNode('developers').with {
appendNode('developer').with {
appendNode('id', 'jskov')
appendNode('name', 'Jesper Skov')
appendNode('email', '[email protected]')
appendNode('organization', 'Jyske Bank')
appendNode('organizationUrl', 'http://www.jyskebank.dk')
appendNode('roles').with {
appendNode('role', 'developer')
}
appendNode('timezone', 'Europe/Copenhagen')
}
}
appendNode('scm').with {
appendNode('connection', 'scm:git:[email protected]:Jyskebank/enunciate-openapi.git')
appendNode('developerConnection', 'scm:git:[email protected]:Jyskebank/enunciate-openapi.git')
appendNode('url', 'https://github.com/Jyskebank/enunciate-openapi')
}
}
}
from components.java
version = publicVersion
}
}
}

model {
tasks.generatePomFileForMavenJavaPublication {
destination = file("dist/publish/${project.name}-${publicVersion}.pom")
destination = new File(publishDir, "${project.name}-${publicVersion}.pom")
}
}

// Prepare packaged ui for eclipse tests
tasks['eclipse'].dependsOn("addPackedSwaggerUiToEclipseTest", "cleanEclipseClasspath")
tasks['test'].dependsOn("addPackedSwaggerUiToTest")

task dist(dependsOn: ["jar", "generatePomFileForMavenJavaPublication"])

task dist(dependsOn: ["jar", "javadocJar", "sourceJar", "generatePomFileForMavenJavaPublication"])
task eclipseIvyChanged(dependsOn: "eclipse")
task eclipseGradlePropertiesChanged(dependsOn: "eclipse")
task eclipsePropertiesFolderChanged(dependsOn: "eclipse")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# These are for the Jyske Bank build system
buildScriptsVersion=unused
jbPlatform = java18
postBuildGpgSign = DD4B9C51:publish/enunciate-openapi-@[email protected],publish/enunciate-openapi-@[email protected]
postBuildGpgSign = DD4B9C51:publish/enunciate-openapi-@[email protected],publish/enunciate-openapi-@VERSION_PUBLIC@-sources.jar,publish/enunciate-openapi-@[email protected],publish/enunciate-openapi-@VERSION_PUBLIC@.pom
5 changes: 5 additions & 0 deletions merge.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ First drop


...


Build and publish internally

Upload artifacts to Maven Central, see http://central.sonatype.org/pages/manual-staging-bundle-creation-and-deployment.html

0 comments on commit b32fe6a

Please sign in to comment.