Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Eclipse - generate javadoc with maven while compiling bundle

Avatar

Level 4

I have Eclipse that is set to work with CQ and I want to generate javadoc during the bundle compilation. I have 4 projects in Eclipse

  • project-default
  • project-default-bundle
  • project-default-components
  • project-default-content

In project-default-bundle(which contains .java classes) I added this to pom.xml file

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <configuration> <excludePackageNames> *.impl </excludePackageNames> </configuration> <executions> <execution> <id>generate-javadoc</id> <goals> <goal>javadoc</goal> </goals> </execution> </executions> </plugin>

bud when I run the maven build(on the project-default project), there is no javadoc generated... I run maven with these goals 'clean install' and profile 'autoInstallPackage'.

I also tried to run these goals 'clean install javadoc:javadoc' but it gives me an error. But when I run maven build with 'javadoc:javadoc' goal on project-default-bundle it generates the javadoc fine.

Thanks for any help!

1 Accepted Solution

Avatar

Correct answer by
Level 6

This is not really a CQ/AEM question, but a Maven question and should be addressed in such a forum. But, since I actually know the answer, I will hint you on what to do.

I don't know where you have defined your plugin, in the <build> section or the <reporting> section but I assume it is in the <reporting> section as you should. Then you should use the mvn site command.

You could also bind the execution to another goal. Read about Maven lifecyle at [1]. Each Maven plugins has goals that and you can bind your execution to different phases and goals. However... I would strongly advice AGAINST binding the site or javadoc creation to the install phase or any of its goals, since that will force the developers to runt the site/javadoc every time the system is compiled/installed.

Instead, use a Continuous Build tool, such as TeamCity, Hudson, Jenkins or any other, and have that tool build your javadoc and site on each commit instead. Or once every day.

 

[1] http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

View solution in original post

1 Reply

Avatar

Correct answer by
Level 6

This is not really a CQ/AEM question, but a Maven question and should be addressed in such a forum. But, since I actually know the answer, I will hint you on what to do.

I don't know where you have defined your plugin, in the <build> section or the <reporting> section but I assume it is in the <reporting> section as you should. Then you should use the mvn site command.

You could also bind the execution to another goal. Read about Maven lifecyle at [1]. Each Maven plugins has goals that and you can bind your execution to different phases and goals. However... I would strongly advice AGAINST binding the site or javadoc creation to the install phase or any of its goals, since that will force the developers to runt the site/javadoc every time the system is compiled/installed.

Instead, use a Continuous Build tool, such as TeamCity, Hudson, Jenkins or any other, and have that tool build your javadoc and site on each commit instead. Or once every day.

 

[1] http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html