I am beating my head against the wall on this and surely I am just being stupid 
so hopefully someone will take pity on me and point me in the right direction.

 

I am trying to add Javadoc generation into my normal build process for my 
multi-module project.  It all works fine if I run "mvn install" on the project 
followed by "mvn javadoc:aggregate-jar" but I would really like to be able to 
generate the javadocs jar as part of the normal build so that it:

 

-        Gets built by default (without having to remember to run the extra 
command)

-        Sets attached to the build so that the install plugin installs it

 

I put something like the following in the top-level POM (the module names have 
been changed to protect the innocent.):

 

<modules>
    <module>mod1</module>
    <module>mod2</module>
    <module>mod3</module>
    <module>mod4</module>
    <module>mod5</module>
    <module>mod6</module>
</modules>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
                <execution>
                    <id>generate-javadoc</id>
                    <goals>
                        <goal>aggregate-jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

 

Unfortunately, this runs the aggregate-jar goal first, before building the 
modules.  Since Java code in the modules reference classes generated by the 
module build, the build generates tons of warnings from the Javadoc plugin 
about not finding the generated classes (which makes sense since they don't 
exist yet) like this:

 

[WARNING] import com.mycompany.mod4.resources.MyResourceBundle;

[WARNING] ^

[WARNING] 
C:\myproject\mod4\src\main\java\com\mycompany\mod4\MyApplication.java:24: 
error: package com.mycompany.mod4.resources does not exist

 

Is there really no way to do this with code generation? 

 

Thanks,

Robert

 

Reply via email to