I'm generating a ZIP of generated Javadoc during mvn install operation by using the following:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>docs-assembly</id>
<phase>package</phase>
<configuration>
<finalName>${project.build.finalName}-${project.version}-Javadoc</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assemble.xml</descriptor>
</descriptors>
</configuration>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
But if I want to generate this ZIP file by launching mvn javadoc:javadoc, the ZIP file is not generated:
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>docs-assembly</id>
<phase>package</phase>
<configuration>
<finalName>${project.build.finalName}-${project.version}-Javadoc</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assemble.xml</descriptor>
</descriptors>
</configuration>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
I Just copy / paste the execution but the docs-assembly is not executed with javadoc:javadoc... why it is not called during javadoc:javadoc call ?
CodePudding user response:
Your main question is: why is maven-assembly-plugin:single
not called during javadoc:javadoc
call?
For this you need to understand the difference between lifecycles and plugin goals.
A plugin goal is a single task, easy to recognize by the colon. So javadoc:javadoc
is a plugin goal.
Consider a lifecycle as an ordered group of plugin goals. You can call a lifecycle-phase (has no colons) and Maven knows which plugins need to be executed. package
is a lifecycle-phase.
So if you are calling javadoc:javadoc
, that will be the only task. There's no reason for Maven to also execute maven-assembly-plugin:single
.
btw, did you try javadoc:jar
? You should know that jar is just a zip file with extras.