Sunday, 8 September 2013

Best way to disable cobertura test for all the child modules from the parent pom

Best way to disable cobertura test for all the child modules from the
parent pom

I am trying to do a maven clean install on my parent pom.xml file by using
the below command-
mvn clean install -Dmaven.test.skip=true -Dmaven.it.skip=true
-DcoberturaHaltOnError=false
But somehow everytime, I am always getting the below error-
[INFO] --- cobertura-maven-plugin:2.5.2:check (default) @ tac-core ---
[INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 237 classes.
[ERROR] com.somehost.core.exception.LockedException failed check. Line
coverage rate of 0.0% is below 80.0%
com.somehost.core.dao.impl.DAOReadOnlyImpl failed check. Branch coverage
rate of 0.0% is below 90.0%
com.somehost.core.dao.impl.DAOReadOnlyImpl failed check. Line coverage
rate of 0.0% is below 80.0%
com.somehost.core.service.Service failed check. Branch coverage rate of
0.0% is below 90.0%
com.somehost.core.service.Service failed check. Line coverage rate of 0.0%
is below 80.0%
com.somehost.core.msg.client.StoreResponse failed check. Branch coverage
rate of 0.0% is below 90.0%
// followed by other errors
I am not sure how to skip this cobertura test in my parent pom.xml file in
such a way such that child modules doesn't get failed. From the above
error it looks like my core module is getting failed (see my parent
pom.xml file below)
Below is my parent pom.xml file-
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.somehost</groupId>
<artifactId>tac-parent</artifactId>
<version>MAIN</version>
<packaging>pom</packaging>
<name>Host-TAC</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<release.version>MAIN</release.version>
<cobertura.version>1.9.4</cobertura.version>
<maven.test.skip>false</maven.test.skip>
<maven.it.skip>false</maven.it.skip>
<coberturaHaltOnError>true</coberturaHaltOnError>
</properties>
<modules>
<module>core</module>
<module>webapp</module>
<module>client</module>
<module>panner</module>
</modules>
<pluginRepositories>
<pluginRepository>
<id>caucho</id>
<name>Caucho</name>
<url>http://caucho.com/m2-snapshot</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>caucho.maven-repo</id>
<name>Caucho Repository</name>
<url>http://caucho.com/m2-snapshot</url>
</repository>
<repository>
<id>java.net-Public</id>
<name>Maven Java Net Snapshots and Releases</name>
<url>https://maven.java.net/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.caucho</groupId>
<artifactId>resin</artifactId>
<version>4.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.caucho</groupId>
<artifactId>resin-javaee</artifactId>
<version>4.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.4-1</version>
</dependency>
<dependency>
<groupId>com.host</groupId>
<artifactId>trustedsource</artifactId>
<version>2.2.0.2</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>12.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
<!--
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.6.4</version>
</dependency>
-->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.somehost</groupId>
<artifactId>tac-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.somehost</groupId>
<artifactId>tac-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.somehost</groupId>
<artifactId>tac-scanner</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.somehost</groupId>
<artifactId>tac-webapp</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>cobertura-instrument</id>
<activation>
<property>
<name>cobertura-build</name>
</property>
</activation>
<modules>
<module>tac-cobertura</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<check>
<haltOnFailure>${coberturaHaltOnerror}</haltOnFailure>
<totalLineRate>90</totalLineRate>
<totalBranchRate>90</totalBranchRate>
</check>
<formats>
<format>html</format>
</formats>
</configuration>
<executions>
<execution>
<id>instrument-code</id>
<phase>process-classes</phase>
<goals>
<goal>instrument</goal>
</goals>
<configuration>
<attach>true</attach>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<inherited>true</inherited>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>net.sourceforge.cobertura</groupId>
<artifactId>cobertura-runtime</artifactId>
<version>${cobertura.version}</version>
<scope>provided</scope>
<type>pom</type>
</dependency>
</dependencies>
</profile>
</profiles>
<build>
<finalName>tac-${project.version}-r${buildNumber}</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<useLastCommittedRevision>true</useLastCommittedRevision>
<scmDirectory>${project.parent.basedir}</scmDirectory>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.6</version>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-resources</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<supportedProjectTypes>
<supportedProjectType>jar</supportedProjectType>
<supportedProjectType>bundle</supportedProjectType>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Build-version>${buildNumber}</Build-version>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<instrumentation>
<includes>
<include>com/somehost/**/*.class</include>
</includes>
<!--
<ignores>
<ignore>com.example.boringcode.*</ignore>
</ignores>
-->
<!--
<excludes>
<exclude>com/example/dullcode/**/*.class</exclude>
<exclude>com/example/**/*Test.class</exclude>
</excludes>
-->
</instrumentation>
<check>
<branchRate>85</branchRate>
<lineRate>85</lineRate>
<haltOnFailure>true</haltOnFailure>
<totalBranchRate>85</totalBranchRate>
<totalLineRate>85</totalLineRate>
<packageLineRate>85</packageLineRate>
<packageBranchRate>85</packageBranchRate>
<regexes>
<regex>
<pattern>com.somehost.*</pattern>
<branchRate>90</branchRate>
<lineRate>80</lineRate>
</regex>
</regexes>
</check>
</configuration>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehause.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

No comments:

Post a Comment