Skip to content

Commit

Permalink
add Automatic-Module-Name to JAR (#85)
Browse files Browse the repository at this point in the history
If the JAR for this repo is used in a project where the module system is
active, Java treats any "plain JAR" without a module descriptor as an
"automatic module" and allows it to be used by other modules in the
application.

For instance, a module in an application using JPMS can depend on this
project like

```
module com.mattnworb.jpms {
  requires com.spotify.completablefutures;
}
```

Defining an `Automatic-Module-Name` allows for explicitly controlling
the name that modules use when loading your automatic module, rather
JPMS guessing at the automatic module name for the JAR based on the
JAR's filename.

Alternatively we could add a `module-info.java` to this project to
enable it to be loaded as a regular (not automatic) module but that
would also require increasing the compiler target from 8 to 9.

Closes #82
  • Loading branch information
mattnworb authored Jul 22, 2021
1 parent ada4ab2 commit 5a46ba2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>com.spotify.completablefutures</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit 5a46ba2

Please sign in to comment.