| Note The original content is taken from the Maven Users Mailing list Subject: Running Macker with Maven 2 |
Hi,
I've recently been trying out the Macker tool ( http://innig.net/macker ) to enforce architectural rules in a project of mine. I did some searching in this mailing list as well as Google if there was a way to run Macker with Maven 2, but only found questions from others asking how this should be done. The existing maven-macker-plugin is for Maven 1, though I have seen a message that there apparently is a Maven 2 plugin in development.
Anyway, I have been fiddling around a bit and found a way to run Macker in Maven 2 until a proper plugin is available, which I thought I'd share here for anyone interested. As I still consider myself as a Maven 2 newbie, I would appreciate any feedback on this solution, if it seems reasonable at all. This is the first time I use the antrun plugin, and I have no experience using Ant before at all.
The description below is for a simple single project following the directory structure expected as default by Maven 2. It should however be simple to adapt it. This is going to be a bit lengthy, so bring a sandwich.
1. In your POM:
2. The build.xml file in ${basedir}. The location for this is configured in the POM plugin configuration above (antfile="${basedir}/build.xml").
3. The macker rules are placed in ${basedir}/src/test/macker/macker.xml. This location is specified in build.xml above at <rules dir="src/test/macker" includes="macker.xml" />
Using 'mvn antrun:run' will run Macker on your compiled classes in ${basedir}/target/classes/
I hope I haven't forgot anything, and that this may be of interest for others as well ![]()
Rune
