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 third-party Snapshot dependencies
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.
- 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.
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)
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.
Note: If you have suggestions for further topics, please leave a comment with your ideas.
.jpg?width=150&height=150&name=fox-2016-1-sq%20(1).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 FoxTry Nexus Repository Free Today
Sonatype Nexus Repository is the world’s most trusted artifact repository manager. Experience the difference and download Community Edition for free.