Usage

Use it to "Cut the Crap!" @see here

How do I use the maven-crap4j-plugin ?

Getting it from the m2repository at jms.sf.net:
edit your ~/.m2/settingx.xml and add a profile containing the jmd repository:

...
<activeProfiles>
    <activeProfile>withJmdRepo</activeProfile>
</activeProfiles>

<profiles>
  <profile>
    <id>withJmdRepo</id>
    <repositories>
      <repository>
        <id>central</id>
        <name>Maven Repository Switchboard</name>
        <layout>default</layout>
        <url>http://repo1.maven.org/maven2</url>
        <snapshots>
          <enabled>false</enabled>
        </snapshots>
      </repository>
    </repositories>
  
    <pluginRepositories>
      <pluginRepository>
        <id>central</id>
        <name>Maven Plugin Repository</name>
        <url>http://repo1.maven.org/maven2</url>
        <layout>default</layout>
        <snapshots>
          <enabled>false</enabled>
        </snapshots>
      </pluginRepository>
      <pluginRepository>
        <id>jmd.sf.net</id>
        <url>http://jmd.sf.net/m2repository</url>
        <snapshots>
          <enabled>true</enabled>
        </snapshots>
      </pluginRepository>
    </pluginRepositories>
  </profile>
</profiles>
...
					            

Now you can use it in the build section in your pom.xml

...				
<build>
...			
    <plugin>
        <groupId>net.sf.jmd</groupId>
        <artifactId>maven-crap4j-plugin</artifactId>
        <version>0.1.1-SNAPSHOT</version>
        <configuration>
            <projectDir>${basedir}</projectDir>
            <crap4jHome>/home/jan/install/crap4j</crap4jHome>
            <reportsCrap4j>target/site/crap4j-reports</reportsCrap4j>
            <libClasspath>lib</libClasspath>
        </configuration>
        <executions>
            <execution>
                <phase>site</phase>
                <goals>
                    <goal>crap4j</goal>
                    <goal>crap4jAnt</goal>
                </goals>
            </execution>
        </executions>
    </plugin>			
...
				

You are now able to build the site including your crap4j-report. Run the plugin using mvn site and don't forget to add a section like:

<menu name="QA" inherit="bottom">
    <item name="crap4j" href="crap4j-reports/index.html" />
</menu>			
			
Note that the crap4j engine depends on the compiled test classes, so you'll might run into trouble after a mvn clean site . You can get away with: mvn clean test-compile site in order to generate the test classes.

You can also generate the report using mvn clean test-compile crap4j:crap4j crap4j:crap4jAnt