Skip to content

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

@rendaw

Description

@rendaw

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions