ktm5124
ktm5124

Reputation: 12123

Best way to set alternate JavaDoc location for all modules?

I'd like to set an alternate JavaDoc location for all my modules in a multi-module maven project. Unfortunately, I have to rely on relative paths, or else use maven properties like ${basedir}, since this is a team project on subversion, and no absolute path will be the same for all of us.

What is the best way to do this? If I have a project structure

parent
   sub1
   sub2
   sub3
      docs

And I want to place the API in sub3/docs, then how can I point all my modules to output HTML files in sub3/docs, when the parent module will recognize a different path to it than the submodules?

Thanks in advance.

Upvotes: 2

Views: 537

Answers (2)

Bohemian
Bohemian

Reputation: 424993

You want to pollute your project build as little as possible, especially with repeated build tweaks. Instead, you're better off creating a separate build process that assembles the javadoc output from its standard location in all projects and publishes it somewhere desirable.

Upvotes: 1

Jintian DENG
Jintian DENG

Reputation: 3202

Add the following to the parent pom and make sure the child pom does not define their own javadoc plugin.

       <build>
       <plugins>
       <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.7</version>

            <configuration>
                <outputDirectory>${project.parent.basedir}/sub3</outputDirectory>
                <reportOutputDirectory>${project.parent.basedir}/sub3</reportOutputDirectory>
                <destDir>docs</destDir>
            </configuration>
        </plugin>
        </plugins>
        </build>

Upvotes: 1

Related Questions