apache / apache/maven-javadoc-plugin

[MJAVADOC-794] Taglet autodetection fails when taglets JAR includes a module-info.class

Open
#1,173 1 comment 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
107
Forks
116
Avg merge
1d 10h
Merged PRs (30d)
16

Description

**[Curtis Rueden](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ctrueden)** opened **[MJAVADOC-794](https://issues.apache.org/jira/browse/MJAVADOC-794?redirect=false)** and commented

Due to a bug in the maven-javadoc-plugin, the following warning gets emitted when a JPMS-modularized artifact containing taglets is included in the javadoc build via a `` tag:

`  [WARNING] Unable to auto-detect Taglet class names from`
`  '/path/to/jar.jar'. Try to specify them with .`

Running with `mvn -X` shows the underlying cause:

`  NoClassDefFoundError: module-info is not a`
`  class because access_flag ACC_MODULE is set`

Removing the `module-info.java` from the component avoids the problem.

The following patch fixes the problem as of `{}ded56a90{`}:

`diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java b/src/main/java/org/apache/maven/plugins/ja>`
`index 835d6332..6e29eadf 100644`
`--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java`
`+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java`
`@@ -904,6 +904,9 @@ public class JavadocUtil {`
`             for (JarEntry jarEntry = jarStream.getNextJarEntry();`
`                     jarEntry != null;`
`                     jarEntry = jarStream.getNextJarEntry()) {`
`+                if ("module-info.class".equals(jarEntry.getName())) {`
`+                    continue;`
`+                `}
`                 Matcher matcher = pattern.matcher(jarEntry.getName());`
`                 if (matcher.matches()) {`
`                     String version = matcher.group("v");`

 

---

**Affects:** 3.6.3

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java, around the JarEntry loop that autodetects taglet classes. Check how module-info.class is handled when scanning a taglets JAR. Done means JPMS-modularized taglet artifacts no longer emit the autodetection warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.