default maven compiler setting

Create a pom-only (<packaging>pom</packaging>) project that has the compiler settings (and any other default settings) you want. You give treat it like any other project (release it; deploy it to your Maven repo, etc.).

Put a parent declaration at the top of your pom files:

<parent>
  <groupId><!-- parent's group id --></groupId>
  <artifactId><!-- parent's artifact id --></artifactId>
  <version><!-- parent's version --></version>
</parent>

It doesn’t help much if all you want to set is compiler settings. But if you find yourself configuring lots of plugins, reports and dependencies in the same way across project, you can create one parent to rule them all.

BTW – be careful about declaring dependencies and plugins in your parent pom file. Usually you’ll want to favor dependencyManagement and pluginManagement. See the documentation for more details.

Leave a Comment