A logging implementation story
From: http://maven.apache.org/plugin-developers/plugin-testing.html
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<dependencies>
<dependency>
<groupId>custom-rule</groupId>
<artifactId>custom-rule-sample</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
...
</plugin>
All you have to do is copy/paste maven-enforcer-plugin configuration to each assembly project, right?
NO.
Copy/paste code in POMs is bad.
Rather than sharing through inheritance (parent POM), share through composition of a POM.
A POM can be built by referencing an artifact which composes settings of that POM.
Artifacts are shared vs. forcing inheritence / copy-paste patterns
Parent POM which is defined that projects must reference to inherit its settings.
Painful and challenging to re-use code across POMs by requiring inheritance to achieve it.
Copy/paste is typically applied across parent POMs of reactor projects.
Enforcer Tile
Compiler Tile
POM
https://github.com/repaint-io/maven-tiles
Referencing a Tile (parent POM of reactor)
<plugin>
<groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId>
<version>${maventiles.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<filtering>true</filtering>
<tiles>
<tile>com.cerner.sync.ml:sync-ml-enforcer-plugin-tile:xml:1.0</tile>
</tiles>
</configuration>
</plugin>