gaul/modernizer-maven-plugin

Java 11 Support

Closed this issue · 8 comments

Hi,

Nice plugin. We have migrated most of our apps from JDK 8 to 11.

Can I leverage the plugin for it ?

Thanks

gaul commented

Yes. Do you have a specific compatibility problem?

The problem is building this plugin
sdk use java 8.0.302-zulu
mvn clean package
works fine !!!!!!

sdk use java 11.0.2-open
mvn clean package
does not work on my Mac

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.4:jar (attach-javadocs) on project modernizer-maven-annotations: MavenReportException: Error while generating Javadoc: [ERROR] Exit code: 1 - javadoc: error - The code being documented uses modules but the packages defined in http://docs.oracle.com/javase/6/docs/api/ are in the unnamed module. [ERROR] [ERROR] Command line was: /Users/me/.sdkman/candidates/java/11.0.2-open/bin/javadoc @options @packages [ERROR] [ERROR] Refer to the generated Javadoc files in '/Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs' dir.

Using the plugin in my applications works fine !!!

krzyk commented

What kind of errors do you get?
Maybe you just get information about new modernizations that you should do in your code?

This is the error I get when I build the plugin

Note when I build this maven plugin.
My own project works fine

Loading source files for package org.gaul.modernizer_maven_annotations...
Constructing Javadoc information...
Standard Doclet version 11.0.2
Building tree for all the packages and classes...
Generating /Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs/org/gaul/modernizer_maven_annotations/SuppressModernizer.html...
Generating /Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs/org/gaul/modernizer_maven_annotations/package-summary.html...
Generating /Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs/org/gaul/modernizer_maven_annotations/package-tree.html...
Generating /Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs/constant-values.html...
Generating /Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs/org/gaul/modernizer_maven_annotations/class-use/SuppressModernizer.html...
Generating /Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs/org/gaul/modernizer_maven_annotations/package-use.html...
Building index for all the packages and classes...
Generating /Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs/overview-tree.html...
Generating /Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs/index-all.html...
Building index for all classes...
Generating /Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs/allclasses-index.html...
Generating /Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs/allpackages-index.html...
Generating /Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs/deprecated-list.html...
Building index for all classes...
Generating /Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs/allclasses.html...
Generating /Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs/allclasses.html...
Generating /Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs/index.html...
Generating /Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs/help-doc.html...
1 error
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for modernizer-maven-parent 2.4.0-SNAPSHOT:
[INFO]
[INFO] modernizer-maven-parent ............................ SUCCESS [ 1.137 s]
[INFO] modernizer-maven-policy ............................ SUCCESS [ 0.416 s]
[INFO] modernizer-maven-annotations ....................... FAILURE [ 1.700 s]
[INFO] Modernizer Maven Plugin ............................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.812 s
[INFO] Finished at: 2021-10-06T19:05:28+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.4:jar (attach-javadocs) on project modernizer-maven-annotations: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - javadoc: error - The code being documented uses modules but the packages defined in http://docs.oracle.com/javase/6/docs/api/ are in the unnamed module.
[ERROR]
[ERROR] Command line was: /Users/me/.sdkman/candidates/java/11.0.2-open/bin/javadoc @options @packages
[ERROR]
[ERROR] Refer to the generated Javadoc files in '/Users/me/data/tutorials/modernizer-maven-plugin/modernizer-maven-annotations/target/apidocs' dir.
[ERROR]
[ERROR] -> [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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :modernizer-maven-annotations

krzyk commented

Earlier versions of jdk 11 had a bug in javadoc. Please try latest jdk 11 build or use JDK 12 for compilation.

https://bugs.openjdk.java.net/browse/JDK-8212233
So you need to either use 11.0.3 or 11.0.8 (not sure why there are two versions mentioned in that bug), or 12.0.1.

For sure the latest 11u contains the fix, so you can also try that.

okay 11.0.12 works
sdk install java 11.0.12-librca
sdk use java 11.0.12-librca
mvn clean package

So it is correct that version 11 works

So the issue can be closed.
I have tested that it works for 11
My contribution to open source for today

gaul commented

@anderskristian thanks for investigating this!