question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Java version parsing fails with some JDKs, module-info.java is not found

See original GitHub issue

With some JDKs, System property java.version returns a single number, for example OpenJDK 17 early-access builds use 17.

This means the following parsing code in Moditect will fail:

https://github.com/moditect/moditect/blob/d2cc464c4abf853d393c05010fd6a3d0de776580/core/src/main/java/org/moditect/internal/parser/JavaVersionHelper.java#L28-L30

https://github.com/moditect/moditect/blob/d2cc464c4abf853d393c05010fd6a3d0de776580/core/src/main/java/org/moditect/internal/parser/JavaVersionHelper.java#L70-L75

As a result, #141 reappears: Moditect is unable to detect module-info.java if it’s in versions/<some-version>.

[INFO] --- moditect-maven-plugin:1.0.0.RC2:add-module-info (add-module-infos) @ hibernate-search-util-common ---
writing to /home/yrodiere/workspaces/main/hibernate-search/util/common/target/moditect/org.hibernate.search.util.common/versions/9/module-info.java
[WARNING] The java version 17 cannot be parsed as ^(\d+)\.(\d+)\.(\d+).*
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Hibernate Search Root POM 6.2.0-SNAPSHOT:
[INFO] 
[INFO] Hibernate Search Root POM .......................... SUCCESS [  1.192 s]
[INFO] Hibernate Search Build - Config .................... SUCCESS [  3.128 s]
[INFO] Hibernate Search Build - Surefire Extension ........ SUCCESS [  1.637 s]
[INFO] Hibernate Search Parent POM for Internal Artifacts . SUCCESS [  1.085 s]
[INFO] Hibernate Search Utils - Internal - Test - Common .. SUCCESS [  4.502 s]
[INFO] Hibernate Search Utils - Internal - Test - ORM ..... SUCCESS [  1.057 s]
[INFO] Hibernate Search Parent POM for Public Artifacts ... SUCCESS [  1.109 s]
[INFO] Hibernate Search Utils - Common .................... FAILURE [  7.770 s]
[INFO] Hibernate Search Engine ............................ SKIPPED
[... ommitted for brevity ...]
[INFO] Hibernate Search Reports ........................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  21.997 s
[INFO] Finished at: 2022-03-31T15:28:32+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.moditect:moditect-maven-plugin:1.0.0.RC2:add-module-info (add-module-infos) on project hibernate-search-util-common: Execution add-module-infos of goal org.moditect:moditect-maven-plugin:1.0.0.RC2:add-module-info failed: Couldn't parse /home/yrodiere/workspaces/main/hibernate-search/util/common/target/moditect/org.hibernate.search.util.common/module-info.java -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :hibernate-search-util-common

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
gunnarmorlingcommented, Apr 11, 2022

Thanks for the reminder! I’ll take a look in the course of this week.

0reactions
gunnarmorlingcommented, Jul 28, 2022

Doh, good catch and call-out, @yrodiere! Appreciate it 🙏 . @aseovic, thanks a lot for those, will check them out ASAP.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maven+JDK9 modules: Failed to parse module-info
I am compiling a project with this module-info.java: module org.project { }. But it fails with a mysterious error: [ERROR] Failed to parse...
Read more >
Java 9: requiring elasticsearch from module-info.java fails with ...
I debugged maven-compiler-plugin and that lead me to jdk.internal.module.ModulePath . It fails in jdk.internal.module.ModulePath at line 557: // ...
Read more >
537665 – Cannot parse module-info file standalone - Bugs
Using JDT parser I cannot parse module-info.java file standalone. Below example : below there is a working one. In Compilation Unit object ...
Read more >
module not found module-info.java - You.com | The Search ...
Your maven logs show slf4j-api being placed on the classpath, not modulepath. You need to upgrade the version of maven-compiler-plugin , as modulepath...
Read more >
Kapt is not compatible with JDK 16+ : KT-45545 - YouTrack
KT-48402 Kapt throws "Fatal Error: Unable to find package java.lang in ... module jdk.compiler does not export com.sun.tools.javac.parser to unnamed module ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found