Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid calling javadoc more than once if creating a site?

I would like to deploy an artifact together with javadoc and a Maven site. I use

clean javadoc:jar site deploy site:deploy

(the split between site and site:deploy is just to avoid the deployment of a site if deploy fails).

Now the javadoc is created twice - once in javadoc:jar and once in site. Is it possible to create it just once and use it both for the javadoc-jar in Nexus and the Maven site?

like image 286
J Fabian Meier Avatar asked Dec 06 '17 08:12

J Fabian Meier


2 Answers

I'm pretty sure the plugin is missing a check if the output is already generated as part of the Maven session. Would be a nice improvement to verify if the output is generated after Maven had started. (and let's add a force-parameter to enforce the creation anyway).

like image 53
Robert Scholte Avatar answered Sep 28 '22 06:09

Robert Scholte


Possible solution that may you use is creation two different scripts for build/deploy and run them one by one:

  1. Firstly - full build with with -Dmaven.javadoc.skip=true, that avoids you to create javadoc
  2. Another - only run mvn javadoc:javadoc command to get actual javadoc

Also, maybe next link help you:

  1. https://maven.apache.org/plugins/maven-javadoc-plugin/examples/selective-javadocs-report.html
  2. https://maven.apache.org/plugins/maven-javadoc-plugin/examples/test-javadocs.html

So, you can specify execution phase of javadoc plugin and specify reportSet.

like image 25
Max Vinogradov Avatar answered Sep 28 '22 06:09

Max Vinogradov