Guidelines for Multi-moduled Maven Project
Separate parent project from container project.
Define properties in the parent POM file as possible.
Define the following properties explicitly for clearness and control.
- Encoding related properties whose default value are dependent on platform.
project.build.sourceEncoding
project.reporting.outputEncoding
- Properties to skip situationally unnecessary long running goals.
skipTests
maven.javadoc.skip
maven.deploy.skip
checkstyle.skip
- Properties to run maven more stable way.
dependency.locations.enabled
: refer If your maven site build is too slow- Paths for executable programs external to Maven
graphviz.home
Define all plugins in the <pluginManagement>
element of parent POM file.
- Don't specify
version
toplugin
definitions in child POM files.
Define repositories in the parent POM file as possible.
Define plugins to analyze or diagnose the sources or resources of the project as a reporting plugin as possible.
Start values for path with ${project.basedir}
, ${project.build.directory}
, ${project.build.outputDirectory}
or so on
- When just specifying relative path such as 'target/classes', the result directory could be different if you build the project from the enclosing project in multi-module case.
- If you specify the path with leading ${project.build.directory}, the resulting directory always would be one that is calculated with the current POM's project.
Use resources in target/classes
not in src/main/resources
, considering resource filtering.
Sample of Parent POM
This is the real sample of parent POM I am using.
0 comments:
Post a Comment