Skip to content

BinaryModuleInfoParser.parse does not take toolchain into account #64

Closed
@bmarwell

Description

@bmarwell

When scanning existing files, org.codehaus.plexus.languages.java.jpms.LocationManager.resolvePaths will take a scanning request containing a possible JavaHome location.

But the BinaryModuleInfoParser does not use this javaHome location,, resulting in:

Caused by: java.lang.module.InvalidModuleDescriptorException: Unsupported major.minor version 59.0
    at jdk.internal.module.ModuleInfo.invalidModuleDescriptor (ModuleInfo.java:1091)
    at jdk.internal.module.ModuleInfo.doRead (ModuleInfo.java:195)
    at jdk.internal.module.ModuleInfo.read (ModuleInfo.java:131)
    at java.lang.module.ModuleDescriptor.read (ModuleDescriptor.java:2487)
    at org.codehaus.plexus.languages.java.jpms.BinaryModuleInfoParser.parse (BinaryModuleInfoParser.java:35)
    at org.codehaus.plexus.languages.java.jpms.AbstractBinaryModuleInfoParser.getModuleDescriptor (AbstractBinaryModuleInfoParser.java:45)
    at org.codehaus.plexus.languages.java.jpms.LocationManager.resolvePaths (LocationManager.java:127)
    at org.apache.maven.plugin.compiler.CompilerMojo.preparePaths (CompilerMojo.java:238)

Downstream issue and how to reproduce in a single, repeated step (try mvn compile twice):
https://issues.apache.org/jira/browse/MCOMPILER-455

Activity

torakiki

torakiki commented on Feb 15, 2021

@torakiki

I checked out the latest snapshot 3.9.0 of the compiler plugin, installed locally and used that in my real life repo together with plexus-java 1.0.6 and I got a warning and a compilation error:

[WARNING] Can't extract module name from classes: Unsupported major.minor version 59.65535
Compilation failure
[ERROR] /home/torakiki/repos/pdf-black/pdfblack-model/src/main/java/module-info.java:[20,22] error: module not found: black.pdf.i18n

So I managed to set up a test multi module repo with a parent and 2 children where child2 depends on child1 https://github.com/torakiki/test and I get the same result, using maven compiler 3.9.0-SNAPSHOT and plexus-java 1.0.6:

[WARNING] Can't extract module name from classes: Unsupported major.minor version 59.0
Compilation failure
[ERROR] /home/torakiki/repos/test/testme-child2/src/main/java/module-info.java:[5,17] error: module not found: test.me.child

From what I can see from the logs child1 module is actually missing from the module path.

added 2 commits that reference this issue on Feb 15, 2021

#64 BinaryModuleInfoParser.parse does not take toolchain into account

#64 BinaryModuleInfoParser.parse does not take toolchain into account

rfscholte

rfscholte commented on Feb 15, 2021

@rfscholte
Member
torakiki

torakiki commented on Feb 15, 2021

@torakiki

Yes, both the test repo and my actual repo are compiling fine

added a commit that references this issue on Feb 15, 2021

#64 BinaryModuleInfoParser.parse does not take toolchain into account

249f8bd
rfscholte

rfscholte commented on Feb 15, 2021

@rfscholte
Member

Fixed with 249f8bd

added this to the 1.0.7 milestone on Feb 15, 2021
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

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @rfscholte@bmarwell@torakiki

        Issue actions

          BinaryModuleInfoParser.parse does not take toolchain into account · Issue #64 · codehaus-plexus/plexus-languages