andhow icon indicating copy to clipboard operation
andhow copied to clipboard

Getting rid of the 'no module descriptor' error in Maven builds

Open code4t2 opened this issue 7 years ago • 4 comments

This error is primarily caused with Maven currently being unable to work with Java 9+ 's module system.

Here's an interesting write up about it by Maven Guru Robert Scholte

The main changes as part of this MR are as follows:

  • andhow-annoitation-processor maven-compiler-plugin targeting Java 9
  • Added an additional option to generate javadoc in HTML 5 to get rid of a lengthy warning about future migrations
  • Added Java 9+ module-info to supply module descriptors to Maven
  • BONUS "The POM for com.sun:tools:jar:___:1.8 is missing, no dependency information available" x2 also eliminated by Modular build
  • maven-enforcer-plugin max Java version increased to <11 from <1.9

This ensures that the output from maven-javadoc-plugin reduced from

[INFO] 
[INFO] --- maven-javadoc-plugin:3.0.1:jar (javadoc-jar) @ andhow ---
[WARNING] The POM for com.sun:tools:jar:sources:1.8 is missing, no dependency information available
[WARNING] The POM for com.sun:tools:jar:javadoc-resources:1.8 is missing, no dependency information available
[ERROR] no module descriptor for org.yarnandtail:andhow
[ERROR] no module descriptor for org.yarnandtail:andhow-core
[ERROR] no module descriptor for org.yarnandtail:andhow-annotation-processor
[INFO] The goal 'org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:javadoc' has not been previously called for the module: 'org.yarnandtail:andhow-core:jar:0.4.1-SNAPSHOT'. Trying to invoke it...
[WARN] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[WARNING] Creating fake javadoc directory to prevent repeated invocations: C:\Users\Titu\Source\github.com\code4t2\andhow\andhow-core\target\apidocs
[INFO] The goal 'org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:javadoc' has not been previously called for the module: 'org.yarnandtail:andhow-annotation-processor:jar:0.4.1-SNAPSHOT'. Trying to invoke it...
[WARN] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[ERROR] MavenInvocationException: Error when invoking Maven, consult the invoker log file: C:\Users\Titu\Source\github.com\code4t2\andhow\andhow\target\invoker\maven-javadoc-plugin410922879.txt
[WARNING] Creating fake javadoc directory to prevent repeated invocations: C:\Users\Titu\Source\github.com\code4t2\andhow\andhow-annotation-processor\target\apidocs
[ERROR] Error fetching link: C:\Users\Titu\Source\github.com\code4t2\andhow\andhow-core\target\apidocs/package-list. Ignored it.
[ERROR] Error fetching link: C:\Users\Titu\Source\github.com\code4t2\andhow\andhow-annotation-processor\target\apidocs/package-list. Ignored it.
[INFO] 
1 warning
[WARNING] Javadoc Warnings
[WARNING] C:\Users\Titu\Source\github.com\code4t2\andhow\andhow-annotation-processor\src\main\java\org\yarnandtail\andhow\compile\CompileUnit.java:153: warning - Tag @see: missing '#': "getInnerPathNames() for just the names of the nested inner classes."
[INFO] Building jar: C:\Users\Titu\Source\github.com\code4t2\andhow\andhow\target\andhow-0.4.1-SNAPSHOT-javadoc.jar
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------

to

[INFO] 
[INFO] --- maven-javadoc-plugin:3.0.1:jar (javadoc-jar) @ andhow ---
[INFO] The goal 'org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:javadoc' has not been previously called for the module: 'org.yarnandtail:andhow-core:jar:0.4.1-SNAPSHOT'. Trying to invoke it...
[WARN] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[WARNING] Creating fake javadoc directory to prevent repeated invocations: C:\Users\Titu\Source\github.com\code4t2\andhow\andhow-core\target\apidocs
[INFO] The goal 'org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:javadoc' has not been previously called for the module: 'org.yarnandtail:andhow-annotation-processor:jar:0.4.1-SNAPSHOT'. Trying to invoke it...
[WARN] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[ERROR] MavenInvocationException: Error when invoking Maven, consult the invoker log file: C:\Users\Titu\Source\github.com\code4t2\andhow\andhow\target\invoker\maven-javadoc-plugin1808595626.txt
[WARNING] Creating fake javadoc directory to prevent repeated invocations: C:\Users\Titu\Source\github.com\code4t2\andhow\andhow-annotation-processor\target\apidocs
[ERROR] Error fetching link: C:\Users\Titu\Source\github.com\code4t2\andhow\andhow-core\target\apidocs/package-list. Ignored it.
[ERROR] Error fetching link: C:\Users\Titu\Source\github.com\code4t2\andhow\andhow-annotation-processor\target\apidocs/package-list. Ignored it.
[INFO] Building jar: C:\Users\Titu\Source\github.com\code4t2\andhow\andhow\target\andhow-0.4.1-SNAPSHOT-javadoc.jar
[INFO] 
[INFO] ----------------< org.yarnandtail:andhow-system-tests >-----------------

Must eliminate that one warning that keeps coming with JDK 8. Will probably raise a tiny MR to fix it later.

Fixes #448

Kindly review bearing in mind this means a (most likely irreversible) move to Java 9+

code4t2 avatar Oct 28 '18 15:10 code4t2

Oh no, looks like the CI build failed. Looking through its logs seems to suggest that it used JDK 1.8 - 191. This wouldn't work, of course. It needs JDK 9+

Tested on my PC with JDK 10.0.1 and Maven 3.5.4

code4t2 avatar Oct 28 '18 15:10 code4t2

Ah, I wouldn't have guessed those module errors are related to JDK9 modules. Maybe they added it as a warning in the newest versions of JDK8.

I cannot switch to JDK9 for this release, otherwise it will not work with projects running on JDK8. I have some discussion of this here.

I should create a roadmap page, but the milestone page has some details of release planning:

  • 0.4.1 This is the release we are working toward now, which is focused on bug fixes and improved testing.
  • 0.5.0 This will be some API changes and potentially break some compatibility, but will still be JDK8
  • 0.6.0 This will be the switch to JDK9

Is there a portion of this PR that can be kept for 0.4.1, or does all of it belong in the 0.6.0 release?

eeverman avatar Oct 28 '18 20:10 eeverman

Ah. Thanks for pointing out the page with the details of milestones. This helps a lot. It's been ages since I looked around GitHub. I mainly use GitLab personally and at work. Will go through the site in detail later today.

No, @eeverman . I do not think any part of #448 can be retained for anything pre-0.6.0 . Every line in there is focused around the single issue, which is also why I had to raise a PR for the single # that removed the last javadoc warning.

On the bright side, unless the package names change #448 could go into 0.6.0 without throwing up any conflicts. It could even be one of the first commits (pending review around JDK9+ module system changes)

code4t2 avatar Oct 29 '18 02:10 code4t2

Related Issue: #375

code4t2 avatar Nov 09 '18 06:11 code4t2