Skip to content

Automatic-Module-Name was removed, breaking JPMS compatibility #93

Description

@hugaleno

Automatic-Module-Name was removed, breaking JPMS compatibility

Description

After upgrading KeePassJava2 from 2.1.4 to 2.2.4, my project no longer builds when using the Java Platform Module System (JPMS).

In version 2.1.4, each module JAR included the Automatic-Module-Name manifest entry, for example:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <manifestEntries>
                        <Automatic-Module-Name>org.linguafranca.pwdb.kdbx</Automatic-Module-Name>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

This allowed consumers using JPMS to reliably require the module by its stable name:

requires org.linguafranca.pwdb.kdbx;

However, this configuration appears to have been removed in 2.2.4. As a result, the JAR no longer contains the Automatic-Module-Name manifest entry, and Java derives an automatic module name from the JAR filename instead. The generated name is different and contains not allowed chars, making it impossible to use.

Expected behavior

The published JARs should continue to expose the same stable automatic module names as previous releases, preserving backward compatibility for JPMS users.

Suggested fix

Restore the Automatic-Module-Name manifest entry in each submodule's pom.xml, as it existed in previous releases:

Example

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <manifestEntries>
                        <Automatic-Module-Name>org.linguafranca.pwdb.kdbx</Automatic-Module-Name>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

This is a non-breaking change for non-JPMS users while restoring compatibility for projects that rely on stable automatic module names.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions