Skip to content

Commit

Permalink
fix: Add Automatic-Module-Name attribute to jar manifests for better …
Browse files Browse the repository at this point in the history
…Java 9+ JPMS compatibility (#477)

Add Automatic-Module-Name attribute to jar manifests for better Java 9+
JPMS compatibility.
Affects: db-scheduler and db-scheduler-boot-starter.

Naturally the automatic module names I have entered are suggestions -
please amend if required.


## Fixes
* Maven warning when compiling modular project: `Required filename-based
automodules detected: [db-scheduler-13.0.0.jar]. Please don't publish
this project to a public artifact repository!`


## Reminders
- [ ] Added/ran automated tests
- [ ] Update README and/or examples
- [x] Ran `mvn spotless:apply`
  • Loading branch information
peter277 authored May 28, 2024
1 parent 8fb484c commit de44763
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
17 changes: 17 additions & 0 deletions db-scheduler-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,21 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>com.github.kagkarlsson.scheduler.springboot</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
9 changes: 9 additions & 0 deletions db-scheduler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,15 @@
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Automatic-Module-Name>com.github.kagkarlsson.scheduler</Automatic-Module-Name>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public static void main(String... args) {

/** Example hack: use a {@link CommandLineRunner} to trigger scheduling of a one-time task. */
@Bean
CommandLineRunner executeOnStartup(Scheduler scheduler, @Qualifier("sampleOneTimeTask") Task<Void> sampleOneTimeTask) {
CommandLineRunner executeOnStartup(
Scheduler scheduler, @Qualifier("sampleOneTimeTask") Task<Void> sampleOneTimeTask) {
log.info("Scheduling one time task to now!");

return ignored ->
Expand Down

0 comments on commit de44763

Please sign in to comment.