Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-5727

In a multi-module project, maven-javadoc-plugin looks for unbuilt artifacts and fails when running from within Hudson, but succeeds when running outside Hudson.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • maven-plugin
    • None

      We have a multi-module project where several modules have a maven-javadoc-plugin's execution of "jar" goal attached to the install phase:

      <build>
      <plugins>
      ...
      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-javadoc-plugin</artifactId>
      <executions>
      <execution>
      <id>attach-javadocs</id>
      <!-- Restrict execution of source compilation to install -->
      <phase>install</phase>
      <goals>
      <goal>jar</goal>
      </goals>
      </execution>
      </executions>
      </plugin>
      </build>

      This build always runs fine when launched from the UNIX shell.

      However, if it's run from Hudson, when the maven-javadoc-plugin runs for the given sub-module artifact, it starts looking for the other artifacts of the current project before they were even built - regardless of the fact that the current artifact does not depend on them.

      For example:

      a successful build launched form the shell:

      [DEBUG] Invoking Maven for the goals: [org.apache.maven.plugins:maven-javadoc-plugin:2.6.1:javadoc] with no properties
      [DEBUG] Using /opt/hudson/tmp/manual/PROJECT-NAME/SUB-MODULE-2/target/invoker/maven-javadoc-plugin928299255.txt to log the invoker
      [DEBUG] Added Javadoc link: http://PROJECT-SITE-HOST/PROJECT-NAME/SUB-MODULE-1/apidocs for the project: GROUP-ID:SUB-MODULE-1:war:0.0.2.1

      an unsuccessful build run from Hudson:

      [DEBUG] Invoking Maven for the goals: [org.apache.maven.plugins:maven-javadoc-plugin:2.6.1:javadoc] with no properties
      [DEBUG] Using /opt/hudson/.hudson/jobs/PROJECT-NAME/workspace/trunk/PROJECT-NAME/SUB-MODULE-2/target/invoker/maven-javadoc-plugin174224230.txt to log the invoker
      [ERROR] MavenInvocationException: Error when invoking Maven, consult the invoker log file: /opt/hudson/.hudson/jobs/PROJECT-NAME/workspace/trunk/PROJECT-NAME/SUB-MODULE-3/target/invoker/maven-javadoc-plugin174224230.txt

      An excerpt from the invoker log file:

      [DEBUG] Trying repository releases
      [DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
      [DEBUG] Checking for pre-existing User-Agent configuration.
      [DEBUG] Adding User-Agent configuration.
      [DEBUG] Connecting to repository: 'releases' with url: 'http://REPOSITORY-MANAGER-HOST/nexus/content/repositories/releases'.
      [DEBUG] Using Proxy: http-proxy
      Downloading: http://REPOSITORY-MANAGER-HOST/nexus/content/repositories/releases/SOME-PATH/SUB-MODULE-3/0.0.2.1/SUB-MODULE-3-0.0.2.1.pom
      [DEBUG] Unable to locate resource in repository
      org.apache.maven.wagon.ResourceDoesNotExistException: Unable to locate resource in repository

      In this example, SUB-MODULE-3 is not anywhere in SUB-MODULE-1's dependencies, and has not been built yet, so it does not exist in the given version anywhere yet (neither the current build's reactor, nor the local repository, nor any of remote repositories).

      When I manually perform a "mvn clean deploy" from the UNIX shell, all relevant artifacts are deployed to the relevant remote repository on our Nexus repository manager.
      After that, all Hudson builds proceed fine because maven-javadoc-plugin can download the artifacts from the previous deployment build.

      However, there are problems with that "solution":

      1) The output of maven-javadoc-plugin depends on artifacts of the previous build, not the current one which may lead to generation of stale content
      2) Cannot make release builds using Hudson because they introduce artifacts with new versions, which aren't present anywhere yet
      3) Manual intervention is required outside Hudson

            Unassigned Unassigned
            olo olo
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: