Skip to content

Commit e9baa52

Browse files
sormurassbrannen
authored andcommitted
Correct file type of module descriptors included in JAR files
Prior to this commit, all JAR files generated for a published module included their compiled module descriptor within the root directory of the artifact. This commit a) includes the compiled module descriptor only in JAR files that have no classifier specified and b) stores the source of each module descriptor within the matching `*-source.jar` file. Fixes #2003
1 parent 83bf310 commit e9baa52

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

buildSrc/src/main/kotlin/java-library-conventions.gradle.kts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ if (project in mavenizedProjects) {
7979
dependsOn(tasks.classes)
8080
archiveClassifier.set("sources")
8181
from(sourceSets.main.get().allSource)
82+
from("${project.projectDir}/src/module/$javaModuleName") {
83+
include("module-info.java")
84+
}
8285
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
8386
}
8487

@@ -92,8 +95,11 @@ if (project in mavenizedProjects) {
9295
include("LICENSE.md", "LICENSE-notice.md")
9396
into("META-INF")
9497
}
95-
from("$buildDir/classes/java/module/$javaModuleName") {
96-
include("module-info.class")
98+
val suffix = archiveClassifier.getOrElse("")
99+
if (suffix.isBlank() || suffix == "all") { // "all" is used by shadow plugin
100+
from("$buildDir/classes/java/module/$javaModuleName") {
101+
include("module-info.class")
102+
}
97103
}
98104
}
99105

0 commit comments

Comments
 (0)