Maven Javadoc aggregate-jar plugin fails because of unresolved dependencies

2.6k views Asked by At

I have multi-module Maven project in which I run the maven-javadoc-plugin to generate javadoc. In my parent pom.xml I have defined the plugin build as follows:

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-javadoc-plugin</artifactId>
   <version>2.9.1</version>
   <configuration>
      <!-- Default configuration for all reports -->
   </configuration>
   <executions>
      <execution>
         <id>aggregate</id>
         <goals>
            <goal>aggregate-jar</goal>
         </goals>
         <phase>install</phase>
                 <configuration>
                     <!-- Specific configuration for the aggregate report -->
                 </configuration>
      </execution>
   </executions>
</plugin>

When I run mvn clean install the build fails with unresolved dependencies, but I see the following warning:

[WARNING] The dependency: [my.application:my-module:jar:1.7.1] can't be resolved but has been found in the reactor (probably snapshots). This dependency has been excluded from the Javadoc classpath. You should rerun javadoc after executing mvn install.

As I am currently building my-module 1.7.1, I would assume Maven to detect this and run the aggregate-jar after building my-module, but for some reason it expects my-module to already be installed in a repo.

My Maven version is 3.0.4. Please keep in mind that I am new to Maven builds so this may be a very simple question, but I was not able to find any answer.

Some observations:

  • The build succeeds if I first run mvn clean install without the javadoc plugin aggregate-jar goal
  • The javadoc plugin aggregate goal runs fine.
  • This bug refers exactly to my issue, but should have been solved in Maven 3 (2010)
1

There are 1 answers

0
Joe On

I run this command in my parent pom and this is how I do it without issues:

<build>
    <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.1</version>
            <executions>
                <execution>
                    <id>attach-javadocs</id>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

When I want to generate the docs, I do mvn javadoc:aggregate