From: Dominik Stadler Date: Thu, 5 Jul 2018 19:53:36 +0000 (+0000) Subject: Java 9: Add Automatic-Module-Name in Jars built via Gradle X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=834f34c41d7b5d18564b56c7a5de36b139353db0;p=poi.git Java 9: Add Automatic-Module-Name in Jars built via Gradle git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1835181 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/build.gradle b/build.gradle index abe51c4efb..859999411e 100644 --- a/build.gradle +++ b/build.gradle @@ -168,6 +168,12 @@ project('main') { testCompile 'junit:junit:4.12' } + jar { + manifest { + attributes 'Automatic-Module-Name': 'org.apache.poi.main' + } + } + // Create a separate jar for test-code to depend on it in other projects // See http://stackoverflow.com/questions/5144325/gradle-test-dependency task testJar(type: Jar, dependsOn: testClasses) { @@ -232,6 +238,12 @@ project('ooxml') { testCompile 'org.openjdk.jmh:jmh-generator-annprocess:1.19' } + jar { + manifest { + attributes 'Automatic-Module-Name': 'org.apache.poi.ooxml' + } + } + // TODO: we should not duplicate this task in each project, but I did not figure out how to inject the artifactId for each project task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) { baseline = 'org.apache.poi:poi-ooxml:' + japicmpversion + '@jar' @@ -268,6 +280,12 @@ project('excelant') { testCompile project(path: ':main', configuration: 'tests') } + jar { + manifest { + attributes 'Automatic-Module-Name': 'org.apache.poi.excelant' + } + } + // TOOD: we should not duplicate this task in each project, but I did not figure out how to inject the artifactId for each project task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) { baseline = 'org.apache.poi:poi-excelant:' + japicmpversion + '@jar' @@ -294,7 +312,13 @@ project('integrationtest') { testCompile 'junit:junit:4.12' } - test { + jar { + manifest { + attributes 'Automatic-Module-Name': 'org.apache.poi.integrationtest' + } + } + + test { // exclude these from the normal test-run exclude '**/TestAllFiles.class' exclude '**/*FileHandler.class' @@ -321,6 +345,12 @@ project('scratchpad') { testCompile project(path: ':main', configuration: 'tests') } + jar { + manifest { + attributes 'Automatic-Module-Name': 'org.apache.poi.scratchpad' + } + } + // TOOD: we should not duplicate this task in each project, but I did not figure out how to inject the artifactId for each project task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) { baseline = 'org.apache.poi:poi-scratchpad:' + japicmpversion + '@jar'