Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute maven plugin _after_ all module builds finish

Tags:

maven

Specifically I am trying to run maven-javadoc-plugin but whenever I change the version numbers on the parent/aggregator pom and all of the children, the first time I run the build it fails because javadoc runs first and can't find any of the new version packages from the modules because they haven't been built yet.

I usually end up having to comment javadoc out for one build and then add it back in once the packages are available in nexus for the new version. However, this likely means that I've been building javadoc on one build old source jars all the time.

I've read suggestions of putting another module in that depends on the other ones but I don't think i can get a module to build the javadoc for peer modules. Having it in the parent builds all of the javadoc for all of the modules, I just need it to happen later. Thanks. Here's my javadoc plugin config.

                    <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <inherited>false</inherited>
                    <executions>
                        <execution>
                            <id>generate-javadoc</id>
                            <phase>package</phase>
                            <goals>
                                <goal>aggregate</goal>
                            </goals>
                            <configuration>
                                <aggregate>true</aggregate>
                                <links>
                                    <link>http://java.sun.com/javase/6/docs/api</link>
                                    <link>http://java.sun.com/javaee/5/docs/api</link>
                                </links>
                                <maxmemory>512</maxmemory>
                                <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
                                <docletArtifact>
                                    <groupId>org.umlgraph</groupId>
                                    <artifactId>doclet</artifactId>
                                    <version>5.2</version>
                                </docletArtifact>
                                <additionalparam>
                                    -inferrel -inferdep -outputencoding utf8 -hide
                                    java.* -collpackages
                                    java.util.*
                                    -qualify -postfixpackage
                                    -nodefontsize 9 -nodefontpackagesize 7
                                </additionalparam>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
like image 747
John Russell Avatar asked Dec 06 '25 03:12

John Russell


1 Answers

One way to get around this problem is not to invoke javadoc plugin in the normal maven lifecycle phase; instead run it separately.

To be specific, remove <phase> tag from the above plugin definition.

Run mvn install javadoc:javadoc from parent.

This will build and install all the modules and the parent and then run javadoc on them.

like image 63
Raghuram Avatar answered Dec 07 '25 21:12

Raghuram



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!