Maven Site Plugin
  1. Maven Site Plugin
  2. MSITE-432

Incorrect classpath is used when site plugin/phase launches javadoc command

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.0-beta-7, 2.0.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Maven 2.2.1
    • Number of attachments :
      1

      Description

      When invoking the site plugin (with javadoc reporting enabled) for a project that depends on both the main artifact and the tests artifact of another project, the classpath passed to the javadoc command is incorrect.

      For example:
      Project A produces the following artifacts:

      • ProjectA-version.jar (main artifact)
      • ProjectA-version-tests.jar (test classes)

      And project B has dependencies similar to this:

      <dependency>
        <groupId>...</groupId>
        <artifactId>Project1</artifactId>
        <version>...</version>
      </dependency>
      <dependency>
        <groupId>...</groupId>
        <artifactId>Project1</artifactId>
        <version>...</version>
        <classifier>tests</classifier>
        <scope>test</scope>
      </dependency>

      Then only one of the jars is included in the classpath passed to the javadoc command. (Normally it seems to be the main artifact, although on one of my projects it was the tests artifact instead.) This causes lots of warnings, or for some projects causes the build to fail.

      Note that if I explicitly run the javadoc goals (i.e. "mvn javadoc:javadoc" or "mvn javadoc:test-javadoc") then the classpath is populated correctly and no errors are shown. It's only when the site plugin/phase launches it that the classpath is wrong. I've also found that the order of the dependencies within the POM file seems to make a difference in some cases.

      I've attached a zip file containing two projects to reproduce this. To run it:

      1. run mvn install on project1
      2. run mvn site on project2 (to see the warnings) or mvn javadoc:test-javadoc

      The warning looks like this:

      [WARNING] Javadoc Warnings
      [WARNING] D:\code\EclipseWorkspaces_chris\PaymentCard\project3\src\main\java\repro3\MyClass3.java:3: cannot find symbol
      [WARNING] symbol  : class MyClass1
      [WARNING] location: package repro1
      [WARNING] import repro1.MyClass1;
      [WARNING] ^

        Issue Links

          Activity

          Hide
          James Ravn added a comment -

          I'm also seeing this issue. It makes site-deploy unusable. I have a module running integration tests that depends on common test artifacts of another module. I could skip it, but want to document the tests.

          Show
          James Ravn added a comment - I'm also seeing this issue. It makes site-deploy unusable. I have a module running integration tests that depends on common test artifacts of another module. I could skip it, but want to document the tests.
          Hide
          Ryan Lea added a comment -

          I've also faced this issue and it blocks to default behaviour of the maven-release-plugin release:perform goal.

          Show
          Ryan Lea added a comment - I've also faced this issue and it blocks to default behaviour of the maven-release-plugin release:perform goal.
          Hide
          Dennis Lundberg added a comment -

          This problem is not in the Site Plugin, it's in Maven core, see MNG-2045.

          A workaround for that issue is to use <type>test-jar</type> instead of <classifier>tests</classifier>.

          Show
          Dennis Lundberg added a comment - This problem is not in the Site Plugin, it's in Maven core, see MNG-2045 . A workaround for that issue is to use <type>test-jar</type> instead of <classifier>tests</classifier>.
          Hide
          James Ravn added a comment - - edited

          Using <type>test-jar</type> exhibits the same exact issue in 2.2.1. The only workaround I can find is to place the test-jar dependency first - this causes the test javadoc to fail instead of the main javadoc.

          Show
          James Ravn added a comment - - edited Using <type>test-jar</type> exhibits the same exact issue in 2.2.1. The only workaround I can find is to place the test-jar dependency first - this causes the test javadoc to fail instead of the main javadoc.

            People

            • Assignee:
              Unassigned
              Reporter:
              Chris Tait
            • Votes:
              6 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: