jamp
jamp

Reputation: 2285

Maven Javadoc Plugin not finding custom taglets

I created some custom JavaDoc Taglets as described here:

http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/taglet/overview.html

They work correctly with the Maven Javadoc Plugin when I manually specify the Taglets classes:

      <taglets>
        <taglet>
          <tagletClass>package.to.YourFirstTagletClass</tagletClass>
        </taglet>

        <taglet>
          <tagletClass>package.to.YourSecondTagletClass</tagletClass>
        </taglet>
        ...
      </taglets>

      <tagletArtifact>
        <groupId>group-Taglet</groupId>
        <artifactId>artifact-Taglet</artifactId>
        <version>version-Taglet</version>
      </tagletArtifact>

as described here: http://maven.apache.org/plugins/maven-javadoc-plugin/examples/taglet-configuration.html

But if I have the plugin auto-detect my Taglets as described at the end of the above link, i.e.:

      <tagletArtifacts>
        <tagletArtifact>
          <groupId>group-FirstTaglet</groupId>
          <artifactId>artifact-FirstTaglet</artifactId>
          <version>version-FirstTaglet</version>
        </tagletArtifact>
      </tagletArtifacts>

Then, when building, I get the following error:

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

Anyone has suggestions on what to check?

Thanks!

Upvotes: 2

Views: 141

Answers (1)

ctrueden
ctrueden

Reputation: 6992

Checking the relevant part of the maven-javadoc-plugin source code, there are three different exception types that can yield this warning. In all cases, if you rerun the build with mvn -X to enable debug mode, you will get a full exception stack trace with more detail.

Here is one such exception I encountered personally when using maven-javadoc-plugin 3.6.3 with a JPMS-modularized project:

[DEBUG] NoClassDefFoundError: module-info is not a class because access_flag ACC_MODULE is set
java.lang.NoClassDefFoundError: module-info is not a class because access_flag ACC_MODULE is set
    at java.lang.ClassLoader.defineClass1 (Native Method)
    at java.lang.ClassLoader.defineClass (ClassLoader.java:1022)
    at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:174)
    at java.net.URLClassLoader.defineClass (URLClassLoader.java:555)
    at java.net.URLClassLoader$1.run (URLClassLoader.java:458)
    at java.net.URLClassLoader$1.run (URLClassLoader.java:452)
    at java.security.AccessController.doPrivileged (Native Method)
    at java.net.URLClassLoader.findClass (URLClassLoader.java:451)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:594)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:527)
    at org.apache.maven.plugins.javadoc.JavadocUtil.getTagletClassNames (JavadocUtil.java:669)

I worked around the problem by removing the module-info.java—i.e. un-modularizing my taglets component.

Edit: I filed an issue about this bug, along with a suggested fix.

Upvotes: 0

Related Questions