Invalid Automatic-Module-Name in mcp-core #722
Draft
+24
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #560
build-helper-maven-pluginto generate a Maven property namedautomatic.module.namegenerated from${project.groupId}.${project.artifactId}, whilst ensuring the value is a syntactically valid Java Module name, by replacing any-characters with.charactersAutomatic-Module-Namein./mcp-core/pom.xmlbnd-maven-pluginconfiguration which was generating a value with an invalid value (Java Module names cannot contain the-character)./pom.xmlmaven-jar-pluginconfiguration to addAutomatic-Module-Nameproperty to the JAR manifest. Doing this here, ensures each sub-project JAR has a valid automatic module nameMotivation and Context
In versions 0.12.1 and older, the SDK consisted of a single module,
mcp. TheAutomatic-Module-Namemanifest attribute was generated by thebnd-maven-plugin. Note that the single module name does not contain any dash (-) characters.In 0.13.0 and later, the SDK was refactored into multiple modules,
mcp-core,mcp-jsonetc. Note the addition of the-character in the artifactId. The existing logic for generatingAutomatic-Module-Namewas not updated, resulting in syntactically invalid values being generated for the value, as Java module names are not allowed contain the-character:With the changes described above, this becomes:
How Has This Been Tested?
META/MANIFEST.MFin each jar is a valid Java module nameBreaking Changes
No breaking changes, no change required by users.
Types of changes
Checklist
Additional context
org.codehaus.mojo:build-helper-maven-pluginis added to the rootpom.xml. This purpose of this plugin is to generate and rewrite the value of${automatic.module.name}property into a syntactically valid Java module nameAutomatic-Module-Nameis moved from thebnd-maven-pluginconfiguration to themaven-jar-pluginconfiguration, so it can be uniformly applied to all sub-modules.