Spring
Spring

Reputation: 11835

Maven: Can not create Javadocs

I can not create javadocs to a folder I like, Here is how my javadoc plugin looks like;

 <build>

            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.9.1</version>
            <configuration>
                <outputDirectory>${build.dir}/resources/javadoc</outputDirectory>
                <reportOutputDirectory>${project.reporting.outputDirectory}/javadoc</reportOutputDirectory>
            </configuration>
            <executions>
                <execution>
                    <id>attach-javadocs</id>
                    <phase>package</phase>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>

Any ideas?

EDIT MAven install leads to error"

Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.9.1:aggregate
  (attach-javadocs) on project priTool: An error has occurred in JavaDocs report     generation:
 [ERROR] Exit code: 1 -            C:\pricing\priWebApp\src\main\..webapp\backend\local\PriUpgradeHelper.java:5:
 package       ..upgrademanager does not exist
[ERROR] import ...upgrademanager.ComponentInfo;

Upgrade Manager is an external dependency, but I can see its jar in library

Upvotes: 0

Views: 2799

Answers (1)

Aaron Digulla
Aaron Digulla

Reputation: 328556

You need to understand the difference between mvn package and mvn install. package creates the JARs in the target folder of the Maven project/module.

If there are more modules, they won't be able to see these JARs - for each project/module, Maven only looks into the local repository to resolve dependencies, even if could resolve them in the same project.

And that's what install does: Package the JARs and then install them into the local repository.

When you have a Maven project, with several modules (a.k.a a reactor build), then never use mvn package. Always use mvn install.

Upvotes: 3

Related Questions