0

I am using the maven-site-plugin (version 3.12.1) to create the site + javadoc reports for a project. I can create the static site with mvn site:site, and browse the individual pages just fine, and see they are all built as I would expect, but I also use mvn site:run to verify it as it would be served. When I run mvn site:run, I can view all the other generated reports (inlduding the xref, test xref, javadoc and checkstyle) but the "test javadoc" report returns an error that culminates in error: package org.junit does not exist

javax.servlet.ServletException: org.apache.maven.doxia.siterenderer.RendererException: Error generating maven-javadoc-plugin:3.5.0:test-aggregate-no-fork report
    at org.apache.maven.plugins.site.run.DoxiaFilter.doFilter(DoxiaFilter.java:172)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:201)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.Server.handle(Server.java:516)
    at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
    at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:137)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.apache.maven.doxia.siterenderer.RendererException: Error generating maven-javadoc-plugin:3.5.0:test-aggregate-no-fork report
    at org.apache.maven.plugins.site.render.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:241)
    at org.apache.maven.plugins.site.run.DoxiaFilter.doFilter(DoxiaFilter.java:150)
    ... 32 more
Caused by: org.apache.maven.reporting.MavenReportException: 
Exit code: 1
/mnt/c/Workspaces/GitHub_Skenvy/Collatz/java/src/test/java/io/github/skenvy/CollatzTest.java:9: error: package org.junit does not exist
import static org.junit.Assert.assertArrayEquals;
                       ^

The docs for both site:site and site:run suggest they both have the same operating attributes, namely

Executes only as a reportSet (reporting goal).

Requires dependency resolution of artifacts in scope: test.

Why does site:run fail to be aware of the JUnit dependency in the test scope when the site:site goal is aware of it;

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

I've had a look at maven error: package org.junit does not exist and Maven 3 and JUnit 4 compilation problem: package org.junit does not exist but neither helped.

My <reporting>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jxr-plugin</artifactId>
        <version>3.3.0</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.5.0</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <reportSets>
          <reportSet>
            <reports>
              <report>checkstyle</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

I'm not sure what else from the pom is relevant; I'll update with anything necessary -- I'm not familiar enough with it to definitely know something isn't relevant, so: this is present in this commit of my project and can be reporoduced by running mvn site:run from within the java directory.

Skenvy
  • 724
  • 1
  • 4
  • 15

0 Answers0