Repositories

In its current alpha stage, Patchwork is only distributed on a private repository so one need to add the repository's address to the set of repositories for a project. This can be done for a single project or for a complete configuration in the settings.xml file.

Here is the pom fragment to use OQube's repositories for downloading Patchwork and some of its components:

 <repositories>
  <repository>
   <id>oqube.com</id>
   <name>OQube artifact repository</name>
   <url>http://www.oqube.com/maven2</url>
   <layout>default</layout>
   <snapshots>
    <enabled>true</enabled>
   </snapshots>
   <releases>
    <enabled>true</enabled>
   </releases>
  </repository>
 </repositories>


 <pluginRepositories>
  <pluginRepository>
   <id>oqube.com</id>
   <name>OQube plugin pluginRepository</name>
   <url>http://www.oqube.com/maven2</url>
   <layout>default</layout>
   <snapshots>
    <enabled>true</enabled>
   </snapshots>
   <releases>
    <enabled>true</enabled>
   </releases>
  </pluginRepository>
 </pluginRepositories>

Configuring POM

A typical POM to use Patchwork would look like this (this one is the POM for runtime module of project Speculoos

<project xmlns="http://maven.apache.org/POM/4.0.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <parent>
  <groupId>speculoos</groupId>
  <artifactId>speculoos</artifactId>
  <version>1.0-SNAPSHOT</version>
 </parent> 
 <groupId>speculoos</groupId>
 <artifactId>speculoos-rt</artifactId>
 <packaging>jar</packaging>
 <version>1.0-SNAPSHOT</version>
 <name>Speculoos Mapper Runtime</name>


  <build>
    <plugins>
     <plugin>
      <groupId>oqube.patchwork</groupId>
      <artifactId>patchwork-maven-plugin</artifactId>
      <executions>
       <execution>
        <id>cover</id>
        <goals> 
         <goal>test</goal>
        </goals>
        <configuration>
         <format>xhtml</format>
         <low>50</low>
         <high>90</high>
        </configuration>
       </execution>       
      </executions>      
     </plugin>
  </plugins>
 </build>


 <reporting>
  <plugins>
   <plugin>
    <groupId>oqube.patchwork</groupId>
    <artifactId>patchwork-maven-plugin</artifactId>
   </plugin>          
  </plugins>
 </reporting>
</project>


This POM binds the plugin's goal test to the project's build with some configuration, and adds the Patchwork report to the set of reports generated by the site build.

Details of configurations and plugin's goals can be found in the plugin documentation

Important Note

At present time, classpath for testing is properly handled by patchwork only if run as part of a full test execution. This is due to the fact that the plugin do not attempt to resolve itself the test classpath but relies on surefire plugin to do this then expects maven to inject it.

This means that if you run mvn patchwork:test, invoking the plugin directly, you'll probably get NoClassDefFoundError exceptions, meaning that dependencies are not resolved.

© 2005-2007  | Last Published: 13-03-2007