Skip to content

Java 9+ module naming #19

@Rakambda

Description

@Rakambda

I have troubles trying to import this library with Gradle. It downloads it fine and is added to the dependencies but can't use it in code.

After some tries it seems to come from the name of the jar file that is downloaded (something like CurseAPI-<commit hash>). Java 9+ may have some trouble to give it an automatic module name because of the hash (as it may contains letters) and thus make it impossible to require it.

If the name matches the regular expression "-(\d+(\.|$))" then the module name will be derived from the subsequence preceding the hyphen of the first occurrence.

https://docs.oracle.com/javase/9/docs/api/java/lang/module/ModuleFinder.html#of-java.nio.file.Path...-

So I wonder if there is a way (and if you want) to make JitPack use a more common version numbering or use the Automatic-Module-Name attribute in the manifest.


Edit:
Using the master-SNAPSHOT version is fine but gives a module name of CurseAPI.master.SNAPSHOT which isn't really the best.

Actually running the app throws an exception because of the hash:

Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for D:\.gradle\caches\modules-2\files-2.1\com.github.TheRandomLabs\CurseAPI\5fff967415\36851ce3c218342bbdb85ffef6052c9e2b8f04fb\CurseAPI-5fff967415.jar
Caused by: java.lang.IllegalArgumentException: CurseAPI.5fff967415: Invalid module name: '5fff967415' is not a Java identifier

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