[ https://issues.apache.org/jira/browse/MJAVADOC-698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17440213#comment-17440213 ]
Gili commented on MJAVADOC-698: ------------------------------- I'm not sure why this didn't break in past releases but I don't think it's a bug in the plugin implementation. If anything, I suggest adding documentation for this use-case. I had to add the following configuration to the javadoc plugin configuration: {code:java} <additionalOptions> <!-- Maven plugins cannot be full-fledged modules due to Maven's use of split packages. automatic-modules are treated as unnamed modules so we need to explicitly export packages to them. --> <option>--add-modules</option> <option>java.xml</option> </additionalOptions>{code} In other words, the javadoc tool expects us to give it Java Modules but Mojos cannot be a full-fledged module. Instead, we need to compile it as an automatic-module and pass {{--add-modules}} to the Javadoc plugin to resolve any missing module-info related dependencies. I hope this helps others. > javadoc:javadoc fails for non-JPMS mojo > --------------------------------------- > > Key: MJAVADOC-698 > URL: https://issues.apache.org/jira/browse/MJAVADOC-698 > Project: Maven Javadoc Plugin > Issue Type: Bug > Components: javadoc > Affects Versions: 3.3.1 > Reporter: Gili > Priority: Major > > I upgraded maven-javadoc-plugin from version 3.2.0 to 3.3.1. At the same > time, I upgraded from JDK 11 to 17. All of a sudden I am getting the > following build failure I was not getting before: > {code:java} > [ERROR] Failed to execute goal > org.apache.maven.plugins:maven-javadoc-plugin:3.3.1:jar (attach-javadocs) on > project maven_plugin: MavenReportException: Error while generating Javadoc: > [ERROR] Exit code: 1 - Loading source file > C:\Users\Gili\Documents\requirements.java\maven_plugin\src\main\java\com\github\cowwoc\requirements\maven\AbstractGeneratorMojo.java... > [ERROR] Loading source file > C:\Users\Gili\Documents\requirements.java\maven_plugin\src\main\java\com\github\cowwoc\requirements\maven\GenerateApiMojo.java... > [ERROR] Loading source file > C:\Users\Gili\Documents\requirements.java\maven_plugin\src\main\java\com\github\cowwoc\requirements\maven\OptimizeExceptionsMojo.java... > [ERROR] Loading source file > C:\Users\Gili\Documents\requirements.java\maven_plugin\src\main\java\com\github\cowwoc\requirements\maven\package-info.java... > [ERROR] Loading source file > C:\Users\Gili\Documents\requirements.java\maven_plugin\src\main\java\com\github\cowwoc\requirements\maven\UnpackMojo.java... > [ERROR] Loading source file > C:\Users\Gili\Documents\requirements.java\maven_plugin\target\generated-sources\plugin\com\github\cowwoc\requirements\maven\HelpMojo.java... > [ERROR] Loading source files for package > com.github.cowwoc.requirements.maven... > [ERROR] Constructing Javadoc information... > [ERROR] > C:\Users\Gili\Documents\requirements.java\maven_plugin\target\generated-sources\plugin\com\github\cowwoc\requirements\maven\HelpMojo.java:8: > error: package org.w3c.dom is not visible > [ERROR] import org.w3c.dom.Document; > [ERROR] ^ > [ERROR] (package org.w3c.dom is declared in module java.xml, but module > com.github.cowwoc.requirements.maven_plugin does not read it) > [ERROR] > C:\Users\Gili\Documents\requirements.java\maven_plugin\target\generated-sources\plugin\com\github\cowwoc\requirements\maven\HelpMojo.java:9: > error: package org.w3c.dom is not visible > [ERROR] import org.w3c.dom.Element; > [ERROR] ^ > [ERROR] (package org.w3c.dom is declared in module java.xml, but module > com.github.cowwoc.requirements.maven_plugin does not read it) > [ERROR] > C:\Users\Gili\Documents\requirements.java\maven_plugin\target\generated-sources\plugin\com\github\cowwoc\requirements\maven\HelpMojo.java:10: > error: package org.w3c.dom is not visible > [ERROR] import org.w3c.dom.Node; > [ERROR] ^ > [ERROR] (package org.w3c.dom is declared in module java.xml, but module > com.github.cowwoc.requirements.maven_plugin does not read it) > [ERROR] > C:\Users\Gili\Documents\requirements.java\maven_plugin\target\generated-sources\plugin\com\github\cowwoc\requirements\maven\HelpMojo.java:11: > error: package org.w3c.dom is not visible > [ERROR] import org.w3c.dom.NodeList; > [ERROR] ^ > [ERROR] (package org.w3c.dom is declared in module java.xml, but module > com.github.cowwoc.requirements.maven_plugin does not read it) > [ERROR] > C:\Users\Gili\Documents\requirements.java\maven_plugin\target\generated-sources\plugin\com\github\cowwoc\requirements\maven\HelpMojo.java:12: > error: package org.xml.sax is not visible > [ERROR] import org.xml.sax.SAXException; > [ERROR] ^ > [ERROR] (package org.xml.sax is declared in module java.xml, but module > com.github.cowwoc.requirements.maven_plugin does not read it) > [ERROR] > C:\Users\Gili\Documents\requirements.java\maven_plugin\target\generated-sources\plugin\com\github\cowwoc\requirements\maven\HelpMojo.java:14: > error: package javax.xml.parsers is not visible > [ERROR] import javax.xml.parsers.DocumentBuilder; > [ERROR] ^ > [ERROR] (package javax.xml.parsers is declared in module java.xml, but > module com.github.cowwoc.requirements.maven_plugin does not read it) > [ERROR] > C:\Users\Gili\Documents\requirements.java\maven_plugin\target\generated-sources\plugin\com\github\cowwoc\requirements\maven\HelpMojo.java:15: > error: package javax.xml.parsers is not visible > [ERROR] import javax.xml.parsers.DocumentBuilderFactory; > [ERROR] ^ > [ERROR] (package javax.xml.parsers is declared in module java.xml, but > module com.github.cowwoc.requirements.maven_plugin does not read it) > [ERROR] > C:\Users\Gili\Documents\requirements.java\maven_plugin\target\generated-sources\plugin\com\github\cowwoc\requirements\maven\HelpMojo.java:16: > error: package javax.xml.parsers is not visible > [ERROR] import javax.xml.parsers.ParserConfigurationException; > [ERROR] ^ > [ERROR] (package javax.xml.parsers is declared in module java.xml, but > module com.github.cowwoc.requirements.maven_plugin does not read it) > [ERROR] 8 errors > [ERROR] > [ERROR] Command line was: cmd.exe /X /C > "C:\Users\Gili\.jdks\openjdk-17.0.1\bin\javadoc.exe @options @packages > @argfile" > [ERROR] > [ERROR] Refer to the generated Javadoc files in > 'C:\Users\Gili\Documents\requirements.java\maven_plugin\target\apidocs' dir. > [ERROR] > [ERROR] -> [Help 1]{code} > The Mojo in question did not change at all. It is not a Java Module so I > don't understand why the Javadoc engine is treating it as such. I would be > more than happy to upgrade the Mojo to a Java Module but at last check this > isn't technically possible (I get {{Error: the unnamed module reads package > org.apache.maven.plugin from both maven.core and maven.plugin.api}}). > Any ideas? -- This message was sent by Atlassian Jira (v8.20.1#820001)