Question

I have multimodule maven project like this

myproject
  framework1
    f1-presentation
      *.java
    f1-core
      *.java
    f1-tag
      *.java

 framework2
   f2-presentation
      *.java
   f2-core
      *.java
   f2-tag
      *.java

I want to create apidocs for all java files. If I run mvn javadoc:aggregate in the project root it creates apidcos in the target directory of project root (target/sites/apidocs). But what I want is to create this apidocs for each 2nd level modules. As for example I want apidocs for all java files of framework1 to be create in framework1/target/sites/apidocs. Same thing goes for framework2. Final result will be like this

myproject
 framework1
    target/sites/apidocs (this will contain javadocs for all its submodules classes)
    f1-presentation
      *.java
    f1-core
      *.java
    f1-tag
      *.java

 framework2
    target/sites/apidocs (this will contain javadocs for all its submodules classes)
    f2-presentation
      *.java
    f2-core
      *.java
    f2-tag
      *.java

Could you guys tell me how to do that using maven javadoc plugin.

Edit: pom.xml in framework1 contains

 <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.8</version>
            <executions>
                <execution>
                    <id>aggregate</id>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                    <phase>package</phase>
                </execution>
            </executions>
        </plugin>
    </plugins>

  </build>
Was it helpful?

Solution

After digging a lot I found that maven javadoc plugin is not so good for multimodule project. Actually what I wanted in my question is not done yet. Its a bug of maven javadoc plugin. Here is the bug link

http://jira.codehaus.org/browse/MJAVADOC-311

OTHER TIPS

One way to achieve this could be to run mvn javadoc:aggregate in each of framework1 and framework2 folders separately.

The other would be to configure the poms of framework1 and framework2 to aggregate as specified in this example and run mvn site from myproject.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top