mirror of
https://github.com/openstreetmap/osmosis.git
synced 2026-01-14 00:36:36 +00:00
Fix maven publish to include all artefacts
The existing Maven publishing configuration was quite old and with the current version of Gradle only publishes the POM file. This change updates the config to follow the latest docs for maven-publish plugin and publishes all artefacts again.
This commit is contained in:
41
build.gradle
41
build.gradle
@ -37,12 +37,23 @@ subprojects {
|
||||
// Apply common configurations to all projects supporting Java.
|
||||
configure(javaProjects) {
|
||||
apply plugin: 'checkstyle'
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'signing'
|
||||
|
||||
sourceCompatibility = 17
|
||||
|
||||
java {
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
javadoc {
|
||||
if(JavaVersion.current().isJava9Compatible()) {
|
||||
options.addBooleanOption('html5', true)
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
/*
|
||||
* Pass on each of our custom properties to the unit tests if they have
|
||||
@ -66,32 +77,11 @@ configure(javaProjects) {
|
||||
configProperties.samedir = configFile.parentFile
|
||||
}
|
||||
|
||||
// Build javadoc and source jars and include in published artifacts.
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
archiveClassifier = 'javadoc'
|
||||
from 'build/docs/javadoc'
|
||||
}
|
||||
task sourcesJar(type: Jar) {
|
||||
from sourceSets.main.allSource
|
||||
archiveClassifier = 'sources'
|
||||
}
|
||||
artifacts {
|
||||
archives jar
|
||||
|
||||
archives javadocJar
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
// Sign all published artifacts if signing is enabled.
|
||||
signing {
|
||||
sign configurations.archives
|
||||
required = Boolean.valueOf(osmosisSigningEnabled)
|
||||
}
|
||||
|
||||
// Configure the maven-publish plugin to upload artifacts to the Sonatype repository.
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
pom {
|
||||
name = project.name
|
||||
packaging = 'jar'
|
||||
@ -132,4 +122,9 @@ configure(javaProjects) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sign all published artifacts if signing is enabled.
|
||||
signing {
|
||||
sign publishing.publications.mavenJava
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user