apache / apache/maven-javadoc-plugin
[MJAVADOC-778] Module not visible when creating test javadocs
- Dominant language
- Java
- Stars
- 107
- Forks
- 116
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 16
Description
**[Kai Hofmann](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=powerstat)** opened **[MJAVADOC-778](https://issues.apache.org/jira/browse/MJAVADOC-778?redirect=false)** and commented
I have an open source java project with java module system on github: https://github.com/PowerStat/Validation
When doing a
```java
mvn site
```
This will result in the following:
```java
[INFO] Generating "Test Javadoc" report --- maven-javadoc-plugin:3.6.0:test-aggregate-no-fork
[INFO] Configuration changed, re-generating javadoc.
[ERROR] Error while creating javadoc report:
Exit code: 1
C:\Users\PowerStat\Documents\Validation\src\test\java\de\powerstat\comparators\test\ComparatorEMailByDomainTests.java:7: error: package org.junit.jupiter.api is not visible
import static org.junit.jupiter.api.Assertions.assertEquals;
^
(package org.junit.jupiter.api is declared in the unnamed module, but module de.powerstat.validation does not read it)
C:\Users\PowerStat\Documents\Validation\src\test\java\de\powerstat\comparators\test\ComparatorEMailByDomainTests.java:7: error: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertEquals;
^
[...]
100 errors
Command line was: cmd.exe /X /C ""C:\Program Files\Java\jdk-17\bin\javadoc.exe" @options @argfile"
Refer to the generated Javadoc files in 'C:\Users\PowerStat\Documents\Validation\target\site\testapidocs' dir.
org.apache.maven.reporting.MavenReportException:
Exit code: 1
C:\Users\PowerStat\Documents\Validation\src\test\java\de\powerstat\comparators\test\ComparatorEMailByDomainTests.java:7: error: package org.junit.jupiter.api is not visible
import static org.junit.jupiter.api.Assertions.assertEquals;
^
(package org.junit.jupiter.api is declared in the unnamed module, but module de.powerstat.validation does not read it)
C:\Users\PowerStat\Documents\Validation\src\test\java\de\powerstat\comparators\test\ComparatorEMailByDomainTests.java:7: error: static import only from classes and interfaces
import static org.junit.jupiter.api.Assertions.assertEquals;
^
[...]
100 errors
Command line was: cmd.exe /X /C ""C:\Program Files\Java\jdk-17\bin\javadoc.exe" @options @argfile"
Refer to the generated Javadoc files in 'C:\Users\PowerStat\Documents\Validation\target\site\testapidocs' dir.
at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.doExecuteJavadocCommandLine (AbstractJavadocMojo.java:5183)
at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.executeJavadocCommandLine (AbstractJavadocMojo.java:5068)
at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.executeReport (AbstractJavadocMojo.java:2028)
at org.apache.maven.plugins.javadoc.TestJavadocReport.executeReport (TestJavadocReport.java:153)
at org.apache.maven.plugins.javadoc.JavadocReport.generate (JavadocReport.java:135)
at org.apache.maven.plugins.site.render.ReportDocumentRenderer.renderDocument (ReportDocumentRenderer.java:226)
at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render (DefaultSiteRenderer.java:348)
at org.apache.maven.plugins.site.render.SiteMojo.renderLocale (SiteMojo.java:194)
at org.apache.maven.plugins.site.render.SiteMojo.execute (SiteMojo.java:143)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
```
I am assuming that the maven-javadoc-plugin is not using the
```java
/src/test/java/module-info.test
```
module descriptor, because this one contains
```java
requires org.junit.jupiter.api;
```
Which should solve the problem.
---
**Affects:** 3.6.0
1 votes, 3 watchers
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure with `mvn site` and the `test-aggregate-no-fork` report, then inspect how the plugin handles `/src/test/java/module-info.test` and its `requires org.junit.jupiter.api` declaration. Done means test Javadocs generate successfully without the module-visibility errors shown in the report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100