We have a handful of Maven best practice and How-Tos documented in the blogs. Over time they get buried by newer posts, but the content is still just as relevant. Here is a summary of what exists:
- Why Putting Repositories in your pom is a bad idea This entry explains how to properly manage repository definitions and why you shouldn’t declare them in your poms.
- Best Practices for Releasing with 3rd Party Snapshot Dependencies This entry describes how to most effectively create your own internal release of a snapshot dependency.
- Maven Continuous Integration Best Practices This entry describes several techniques for running Maven builds from a CI system.
- How to Detect if you have a Snapshot Version This entry shows the code that Maven uses to detect a snapshot version. This is helpful if you have non-standard release versions to make sure they won’t be detected by Maven as a snapshot.
- Optimal Maven Plugin Configuration This entry gives some tips on how to configure plugins in a way that makes it easier to understand what is happening in your pom.
- Adding additional source folders to your maven build This entry shows how to use the buildhelper plugin to add additional source folders to your build. This is common if you have tools that generate sources that don’t have a maven plugin to add the source folder automatically.
- Misused Maven Terms Defined This entry explains several terms that are often misquoted. It also specifically discusses classifiers and attached artifacts.
- How to override a plugin’s dependency This shows how you can override a plugin dependency in your own pom…for example if you want to use a newer version of a tool wrapped by a plugin (pmd, checkstyle, cobertura are common examples)
- How to share resources across projects This entry will show you how to share resources in a repeatable way without using relative paths in your poms. It also shows a technique for sharing checkstyle and pmd configurations across all your modules.
- How Plugin versions are determined This entry is actually part of the Maven 2.0.9 announcement, but explains how Maven determines which version of a plugin to use, and why you should use PluginManagement to control the versions yourself.
- How to convert from ant to maven in 5 minutes
- How to make an executable jar
Note: If you have suggestions for further topics, please leave a comment with your ideas.