I do not want to have the documentation of a multi-module Maven project under site
folder for Maven Site workflow. The documentation lives under project-docs
with the project-parent
. What's the best practice packaging
for such module?
The setup is
jar
prepare-package
under some directory (src/main/docs
) of project-docs
during build workflow.default
Maven assembly descriptor that generates a project-docs-NNN-default.zip
.Regarding the (3) in above, the alternatives:
pom
Does not support prepare-package
as the probably most suitable phase. If then phase site
is used, you cannot have the generated documentation inside the default install
life cycle.
jar
The empty JAR is useless!
Some of the valid packaging values are jar , war , ear and pom . If no packaging value has been specified, it will default to jar .
The first step in having a good documentation is to have an accurate and visible basic project information, Maven can provide this for the plugin as long as the information in the POM is complete, descriptive and accurate.
A Maven module is a sub-project. To create a Maven module you will need to already have a Maven project available. The parent project must have its Packaging option pre-configured to pom, for a module to be created and associated with it.
Since you do not want to use site
generation for documentation, I think there is no other "maven official way" to perform it.
From my point of view, you may use a standard POM packaging, zip it through maven-assembly-plugin and add a classfier (doc or everything else).
Here some information to accomplish it :
Even if it's already OK, there is interesting point there.
<groupId>com.mycompany</groupId>
<artifactId>your-project</artifactId>
<version>1.1.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>doc-packaging</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>/src/main/assembly/doc.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Assembly descriptor : It will produce this artifact : your-project-doc.zip :
Since pom doesn't have anything to prepare, you're right, there is no prepare-package
phase (as per doc) . Indeed, your project aims to package doc ... so it would be correct to (re)bind your pdf plugin execution to package
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With