To execute plugin during certain phase, add <phase> to <execution>. Plugin
should be fired: <executions> <execution> <id>attach-javadocs</id> <phase>install</phase> <------ HERE <goals> <goal>aggregate-jar</goal> </goals> </execution> </executions> Regards Sarath Shasikumar Systems Engineer Tata Consultancy Services Cell:- +91 97 46 136153 Mailto: sarath.shasiku...@tcs.com Website: http://www.tcs.com ____________________________________________ Experience certainty. IT Services Business Solutions Consulting ____________________________________________ From: Robert Patrick <robert.patr...@oracle.com> To: users@maven.apache.org Date: 01/14/2016 10:24 AM Subject: Maven javadoc plugin's aggregate-jar goal, multi-module project, and code generation 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 =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you