Skip to content

Commit 5e0897c

Browse files
committed
Add Automatic-Module-Name to manifest file
This commit updates the build to add an `Automatic-Module-Name` entry to the manifest of each published jar. The names follow a convention where the hyphen is replaced by a dot: * `spring-xml`: `spring.xml` * `spring-ws-core`: `spring.ws.core` * `spring-ws-security`: `spring.ws.security` * `spring-ws-support`: `spring.ws.support` * `spring-ws-test`: `spring.ws.test` Closes gh-1208
1 parent 122def7 commit 5e0897c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Diff for: gradle/plugins/conventions-plugin/src/main/java/org/springframework/ws/gradle/conventions/JavaPluginConventions.java

+10-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.ws.gradle.conventions;
1818

1919
import java.util.Map;
20+
import java.util.TreeMap;
2021

2122
import io.spring.javaformat.gradle.SpringJavaFormatPlugin;
2223
import org.gradle.api.JavaVersion;
@@ -79,11 +80,15 @@ private void configureDependencyManagement(Project project) {
7980
}
8081

8182
private void configureJarManifest(Project project) {
82-
project.getTasks()
83-
.named("jar", Jar.class,
84-
(jar) -> jar.manifest((manifest) -> manifest.attributes(Map.of("Build-Jdk-Spec",
85-
JAVA_BASELINE.getMajorVersion(), "Built-By", "Spring", "Implementation-Title",
86-
project.getDescription(), "Implementation-Version", project.getVersion()))));
83+
project.getTasks().named("jar", Jar.class, (jar) -> jar.manifest((manifest) -> {
84+
Map<String, Object> attributes = new TreeMap<>();
85+
attributes.put("Automatic-Module-Name", project.getName().replace("-", "."));
86+
attributes.put("Build-Jdk-Spec", JAVA_BASELINE.getMajorVersion());
87+
attributes.put("Built-By", "Spring");
88+
attributes.put("Implementation-Title", project.getDescription());
89+
attributes.put("Implementation-Version", project.getVersion());
90+
manifest.attributes(attributes);
91+
}));
8792
}
8893

8994
private void configureToolchain(Project project, JavaPluginExtension java) {

0 commit comments

Comments
 (0)