[ https://issues.apache.org/jira/browse/MJAVADOC-704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17476960#comment-17476960 ]
Gili commented on MJAVADOC-704: ------------------------------- The error {{module not found: org.slf4j}} was caused by [https://bugs.openjdk.java.net/browse/JDK-8208269.|https://bugs.openjdk.java.net/browse/JDK-8208269,] Building using JDK 17 fixed that problem. The original question remains: why am I getting a different result when building using JDK 8 versus 17? I am expecting {{jdkToolchains.version=17 }}to cause JDK 17's javadoc tool to get used, but it does not seem to. > Javadoc plugin does not respect jdkToolchain > -------------------------------------------- > > Key: MJAVADOC-704 > URL: https://issues.apache.org/jira/browse/MJAVADOC-704 > Project: Maven Javadoc Plugin > Issue Type: Bug > Components: jar > Affects Versions: 3.3.1 > Reporter: Gili > Priority: Major > > If I run the following using JDK 8: > {code:java} > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-javadoc-plugin</artifactId> > <version>3.3.1</version> > <executions> > <execution> > <id>attach-javadocs</id> > <goals> > <goal>jar</goal> > </goals> > <configuration> > <jdkToolchain> > <version>11</version> > </jdkToolchain> > <!-- ... ---> > </execution> > </executions> > </plugin>{code} > I get: > {code:java} > [INFO] Toolchain in maven-javadoc-plugin: JDK[C:\Program > Files\Java\jdk-11.0.2] > org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute > goal org.apache.maven.plugins:maven-javadoc-plugin:3.3.1:jar > (attach-javadocs) on project core: Execution attach-javadocs of goal > org.apache.maven.plugins:maven-javadoc-plugin:3.3.1:jar failed. > [...] > Caused by: java.lang.UnsupportedOperationException > at > org.codehaus.plexus.languages.java.jpms.CmdModuleNameExtractor.getModuleName > (CmdModuleNameExtractor.java:46){code} > If I run the same code using JDK 11 I get past this point (I get an error > relating to the contents of module-info): > {code:java} > [ERROR] Failed to execute goal > org.apache.maven.plugins:maven-javadoc-plugin:3.3.1:jar (attach-javadocs) on > project core: MavenReportException: Error while generating Javadoc: > [ERROR] Exit code: 1 - > C:\Users\Gili\Documents\pouch\core\src\main\java\module-info.java:3: error: > module not found: org.slf4j > [ERROR] requires org.slf4j; > [ERROR] ^ > [ERROR] > [ERROR] Command line was: cmd.exe /X /C ""C:\Program > Files\Java\jdk-11.0.2\bin\javadoc.exe" @options @argfile" > [ERROR] > [ERROR] Refer to the generated Javadoc files in > 'C:\Users\Gili\Documents\pouch\core\target\apidocs' dir. > [ERROR] > [ERROR] -> [Help 1] {code} > This seems to imply that {{jdkToolchain}} is being ignored. > On the other hand, if I use {{jdkToolchain}} with the maven-compiler-plugin > it seems to work just fine. My toolchains.xml file contains: > {code:java} > <?xml version="1.0" encoding="UTF8"?> > <toolchains> > <toolchain> > <type>jdk</type> > <provides> > <version>11</version> > <vendor>oracle</vendor> > </provides> > <configuration> > <jdkHome>C:\Program Files\Java\jdk-11.0.2</jdkHome> > </configuration> > </toolchain> > </toolchains> {code} > Am I doing anything wrong? Or is this a possible bug in the plugin? -- This message was sent by Atlassian Jira (v8.20.1#820001)