Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jdeps in openjdk 11.0.11 also uses versions/N directory for module-info.java output #141

Closed
rendaw opened this issue May 11, 2021 · 4 comments

Comments

@rendaw
Copy link

rendaw commented May 11, 2021

I'm not 100% sure about this, but in CI with 11.0.11 my build is failing due to:

Caused by: java.nio.file.NoSuchFileException: /builds/project-0/common/target/moditect/common/module-info.java
    at sun.nio.fs.UnixException.translateToIOException (UnixException.java:92)
    at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:111)
    at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:116)
    at sun.nio.fs.UnixFileSystemProvider.newByteChannel (UnixFileSystemProvider.java:219)
    at java.nio.file.Files.newByteChannel (Files.java:371)
    at java.nio.file.Files.newByteChannel (Files.java:422)
    at java.nio.file.spi.FileSystemProvider.newInputStream (FileSystemProvider.java:420)
    at java.nio.file.Files.newInputStream (Files.java:156)
    at org.moditect.internal.shaded.javaparser.Providers.provider (Providers.java:70)
    at org.moditect.internal.shaded.javaparser.JavaParser.parse (JavaParser.java:231)
    at org.moditect.internal.shaded.javaparser.StaticJavaParser.parse (StaticJavaParser.java:157)
    at org.moditect.internal.compiler.ModuleInfoCompiler.parseModuleInfo (ModuleInfoCompiler.java:57)
    at org.moditect.commands.GenerateModuleInfo.parseGeneratedModuleInfo (GenerateModuleInfo.java:394)
    at org.moditect.commands.GenerateModuleInfo.run (GenerateModuleInfo.java:194)
    at org.moditect.mavenplugin.generate.ModuleInfoGenerator.generateModuleInfo (ModuleInfoGenerator.java:155)
    at org.moditect.mavenplugin.add.AddModuleInfoMojo.getModuleInfoSource (AddModuleInfoMojo.java:330)
    at org.moditect.mavenplugin.add.AddModuleInfoMojo.execute (AddModuleInfoMojo.java:169)

Locally (11.0.10) the build works fine.

I stuck a find common in there and see:

common/target/moditect
common/target/moditect/common
common/target/moditect/common/versions
common/target/moditect/common/versions/9
common/target/moditect/common/versions/9/module-info.java

So it appears jdeps is writing module-info to the versions/9 directory.

Per https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2021-April/005860.html

JDK-8229396: jdeps ignores multi-release when generate-module-info used on command line

It looks like this change snuck in the change that writes to the multi-release directory:
http://cr.openjdk.java.net/~mchung/jdk14/8229396/webrev.00/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleInfoBuilder.java.udiff.html

For other people reading, there's code in moditect to use the versions/N directory if your java version is 14 or higher, so using openjdk 14+ might be a workaround.

@gunnarmorling
Copy link
Member

@fax4ever, @yrodiere, if you wanted to look into this, I believe here would be the right starting point.

@fax4ever
Copy link
Contributor

Thanks @gunnarmorling, I'm gonna try to solve it.

@fax4ever
Copy link
Contributor

fax4ever commented Aug 12, 2021

@gunnarmorling I sent my idea to address more cases... let me know what you think of it. Thanks

gunnarmorling pushed a commit that referenced this issue Sep 1, 2021
…argument

* Add helper to parse and extract java version
* Use version for multi release JDK 11.0.11+
* Support --multi-release=X case
@gunnarmorling
Copy link
Member

Squashed and applied the provided fix. Thanks a lot, @fax4ever!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants