diff --git a/build.gradle b/build.gradle index 0de12b2c4..0bd3f19f9 100644 --- a/build.gradle +++ b/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 + } }