11

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?

River
  • 8,585
  • 14
  • 54
  • 67
J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142

2 Answers2

5

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).

Robert Scholte
  • 11,889
  • 2
  • 35
  • 44
  • I'm sorry, actually I don't understand your advice (or what I should try)? As we start with a `clean`, everything is created after Maven has started. – J Fabian Meier Dec 10 '17 at 11:44
  • It is not an advice, I'm saying that if you call 2 goals of the maven-javadoc-plugin, it will call the javadoc tool twice due to missing optimization. – Robert Scholte Dec 10 '17 at 14:37
1

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.

Max Vinogradov
  • 1,343
  • 1
  • 13
  • 31