1

I am building a Maven project with the maven-javadoc-plugin attached.

After updating to maven-javadoc-plugin 3.5.0, this error appears while running the jar goal:

Execution build-javadoc-jar of goal org.apache.maven.plugins:maven-javadoc-plugin:3.5.0:jar failed:
  Unable to derive module descriptor for /.../rewrite-gradle-7.38.0.jar
  PluginSpec.class found in top-level directory (unnamed package not allowed in module)

I don't control that 3th party dependency. And I don't use JPMS.

Is there a way to tell the javadoc tool to ignore module naming?


Source code that reproduces the problem:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>reproducer</groupId>
  <artifactId>reproducer</artifactId>
  <version>0.1</version>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.11.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.3.0</version>
          <configuration>
            <archive>
              <manifestEntries>
                <Automatic-Module-Name>org.acme.reproducer</Automatic-Module-Name>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.5.0</version><!-- Regression from 3.2.0 which did not have the problem-->
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.openrewrite.recipe</groupId>
        <artifactId>rewrite-recipe-bom</artifactId>
        <version>1.17.0</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.openrewrite</groupId>
      <artifactId>rewrite-gradle</artifactId>
    </dependency>
  </dependencies>
</project>
Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
  • Do you have a full working example... It would be the best to file in an issue on https://issues.apache.org/jira/browse/MJAVADOC including the example... – khmarbaise Mar 17 '23 at 18:03
  • Here's an isolated reproducer: https://github.com/ge0ffrey/maven-javadoc-plugin-3.5.0-reproducer Here's the issue: https://issues.apache.org/jira/browse/MJAVADOC-747 Does that help? – Geoffrey De Smet Mar 20 '23 at 14:42
  • can't you just exludepackagename from maven-javadoc-plugin for that problematic library? – ByeBye Mar 24 '23 at 19:52
  • When you say the error occurs "while running the jar", what does that actually mean, as mvn jar:jar doesn't exhibit the error? Also, what maven version are you using? – jon hanson Mar 25 '23 at 17:23
  • The package name is apparently the default package. – Geoffrey De Smet Mar 29 '23 at 12:48
  • Maven 3.8.6. The reason that mvn jar:jar doesn't exhibit is probably because it's the compiler plugin, not the jar plugin, that checks modules stuff. But the javadoc:jar goal does both jar creation and checking module stuff since 3.3.0 (which causes the regression). – Geoffrey De Smet Mar 29 '23 at 12:50

0 Answers0