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
- Best Practices for Releasing with 3rd Party Snapshot Dependencies
- Maven Continuous Integration Best Practices
- How to Detect if you have a Snapshot Version
- Optimal Maven Plugin Configuration
- Adding additional source folders to your maven build
- Misused Maven Terms Defined
- How to override a plugin's dependency
- How to share resources across projects
- How Plugin versions are determined
- How to convert from ant to maven in 5 minutes
- How to make an executable jar
This entry explains how to properly manage repository definitions and why you shouldn't declare them in your poms.
This entry describes how to most effectively create your own internal release of a snapshot dependency.
This entry describes several techniques for running Maven builds from a CI system.
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.
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.
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.
This entry explains several terms that are often misquoted. It also specifically discusses classifiers and attached artifacts.
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)
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.
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.
Note: If you have suggestions for further topics, please leave a comment with your ideas.
.jpg)
Brian Fox, CTO and co-founder of Sonatype, is a Governing Board Member for the Open Source Security Foundation (OpenSSF), a Governing Board Member for the Fintech Open Source Foundation (FINOS), a member of the Monetary Authority of Singapore Cyber and Technology Resilience Experts (CTREX) Panel, a ...
Explore All Posts by Brian Fox