aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jacoco-maven-plugin.test/it/it-offline-instrumentation/child-without-main-classes/pom.xml24
-rw-r--r--jacoco-maven-plugin.test/it/it-offline-instrumentation/child-without-main-classes/src/test/java/ExampleTest.java20
-rw-r--r--jacoco-maven-plugin.test/it/it-offline-instrumentation/child/pom.xml24
-rw-r--r--jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/main/java/DoNotInstrument.java18
-rw-r--r--jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/main/java/Example.java18
-rw-r--r--jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/test/java/ExampleTest.java21
-rw-r--r--jacoco-maven-plugin.test/it/it-offline-instrumentation/pom.xml86
-rw-r--r--jacoco-maven-plugin.test/it/it-offline-instrumentation/verify.bsh28
-rw-r--r--jacoco-maven-plugin/src/org/jacoco/maven/FileFilter.java23
-rw-r--r--jacoco-maven-plugin/src/org/jacoco/maven/InstrumentMojo.java93
-rw-r--r--jacoco-maven-plugin/src/org/jacoco/maven/RestoreMojo.java45
-rw-r--r--org.jacoco.doc/docroot/doc/changes.html2
-rw-r--r--org.jacoco.doc/docroot/doc/index.html3
-rw-r--r--org.jacoco.doc/docroot/doc/maven.html2
-rw-r--r--org.jacoco.examples/build/pom-offline.xml92
15 files changed, 494 insertions, 5 deletions
diff --git a/jacoco-maven-plugin.test/it/it-offline-instrumentation/child-without-main-classes/pom.xml b/jacoco-maven-plugin.test/it/it-offline-instrumentation/child-without-main-classes/pom.xml
new file mode 100644
index 00000000..e269bf72
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-offline-instrumentation/child-without-main-classes/pom.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2009, 2013 Mountainminds GmbH & Co. KG and Contributors
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Evgeny Mandrikov - initial API and implementation
+-->
+<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>
+
+ <parent>
+ <groupId>jacoco</groupId>
+ <artifactId>it-offline-instrumentation</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>child-without-main-classes</artifactId>
+
+</project>
diff --git a/jacoco-maven-plugin.test/it/it-offline-instrumentation/child-without-main-classes/src/test/java/ExampleTest.java b/jacoco-maven-plugin.test/it/it-offline-instrumentation/child-without-main-classes/src/test/java/ExampleTest.java
new file mode 100644
index 00000000..a31fd5e9
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-offline-instrumentation/child-without-main-classes/src/test/java/ExampleTest.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Mountainminds GmbH & Co. KG and Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+import org.junit.Test;
+
+public class ExampleTest {
+
+ @Test
+ public void test() {
+ }
+
+}
diff --git a/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/pom.xml b/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/pom.xml
new file mode 100644
index 00000000..62a3fbd6
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/pom.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2009, 2013 Mountainminds GmbH & Co. KG and Contributors
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Evgeny Mandrikov - initial API and implementation
+-->
+<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>
+
+ <parent>
+ <groupId>jacoco</groupId>
+ <artifactId>it-offline-instrumentation</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>child</artifactId>
+
+</project>
diff --git a/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/main/java/DoNotInstrument.java b/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/main/java/DoNotInstrument.java
new file mode 100644
index 00000000..d51ac9eb
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/main/java/DoNotInstrument.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Mountainminds GmbH & Co. KG and Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+public class DoNotInstrument {
+
+ public void sayHello() {
+ System.out.println("Hello world");
+ }
+
+}
diff --git a/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/main/java/Example.java b/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/main/java/Example.java
new file mode 100644
index 00000000..630a62f2
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/main/java/Example.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Mountainminds GmbH & Co. KG and Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+public class Example {
+
+ public void sayHello() {
+ System.out.println("Hello world");
+ }
+
+}
diff --git a/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/test/java/ExampleTest.java b/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/test/java/ExampleTest.java
new file mode 100644
index 00000000..d9b78ab9
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/test/java/ExampleTest.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Mountainminds GmbH & Co. KG and Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+import org.junit.Test;
+
+public class ExampleTest {
+
+ @Test
+ public void test() {
+ new Example().sayHello();
+ }
+
+}
diff --git a/jacoco-maven-plugin.test/it/it-offline-instrumentation/pom.xml b/jacoco-maven-plugin.test/it/it-offline-instrumentation/pom.xml
new file mode 100644
index 00000000..fb9ee3da
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-offline-instrumentation/pom.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2009, 2013 Mountainminds GmbH & Co. KG and Contributors
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Evgeny Mandrikov - initial API and implementation
+-->
+<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>
+
+ <parent>
+ <groupId>jacoco</groupId>
+ <artifactId>setup-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>it-offline-instrumentation</artifactId>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>child</module>
+ <module>child-without-main-classes</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>org.jacoco.agent</artifactId>
+ <classifier>runtime</classifier>
+ <version>@project.version@</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>instrument-classes</id>
+ <goals>
+ <goal>instrument</goal>
+ </goals>
+ <configuration>
+ <excludes>
+ <exclude>**/DoNotInstrument.class</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>restore-instrumented-classes</id>
+ <goals>
+ <goal>restore-instrumented-classes</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>report</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <dataFile>${project.build.directory}/coverage.exec</dataFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <jacoco-agent.destfile>${project.build.directory}/coverage.exec</jacoco-agent.destfile>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/jacoco-maven-plugin.test/it/it-offline-instrumentation/verify.bsh b/jacoco-maven-plugin.test/it/it-offline-instrumentation/verify.bsh
new file mode 100644
index 00000000..89e2e303
--- /dev/null
+++ b/jacoco-maven-plugin.test/it/it-offline-instrumentation/verify.bsh
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Mountainminds GmbH & Co. KG and Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+import java.io.*;
+import org.codehaus.plexus.util.*;
+
+File file = new File( basedir, "child/target/generated-classes/jacoco/Example.class" );
+if ( !file.isFile() ) {
+ throw new RuntimeException( "Could not find backup of instrumented class: " + file );
+}
+file = new File( basedir, "child/target/generated-classes/jacoco/DoNotInstrument.class" );
+if ( file.isFile() ) {
+ throw new RuntimeException( "Excluded file should not be instrumented: " + file );
+}
+
+file = new File( basedir, "child/target/coverage.exec" );
+if ( !file.isFile() )
+{
+ throw new FileNotFoundException( "Could not find generated dump: " + file );
+}
diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/FileFilter.java b/jacoco-maven-plugin/src/org/jacoco/maven/FileFilter.java
index 99b24c92..81b8a4df 100644
--- a/jacoco-maven-plugin/src/org/jacoco/maven/FileFilter.java
+++ b/jacoco-maven-plugin/src/org/jacoco/maven/FileFilter.java
@@ -8,15 +8,18 @@
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
- *
+ *
*******************************************************************************/
package org.jacoco.maven;
-import java.util.List;
-
import org.apache.commons.collections.CollectionUtils;
+import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
/**
* A file filter using includes/excludes patterns.
*/
@@ -42,6 +45,20 @@ public class FileFilter {
}
/**
+ * Returns a list of files.
+ *
+ * @param directory
+ * the directory to scan
+ * @return a list of files
+ * @throws IOException
+ */
+ @SuppressWarnings("unchecked")
+ public List<String> getFileNames(final File directory) throws IOException {
+ return FileUtils.getFileNames(directory, getIncludes(), getExcludes(),
+ false);
+ }
+
+ /**
* Get the includes pattern
*
* @return the pattern
diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/InstrumentMojo.java b/jacoco-maven-plugin/src/org/jacoco/maven/InstrumentMojo.java
new file mode 100644
index 00000000..0888b796
--- /dev/null
+++ b/jacoco-maven-plugin/src/org/jacoco/maven/InstrumentMojo.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Mountainminds GmbH & Co. KG and Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
+import org.jacoco.core.instr.Instrumenter;
+import org.jacoco.core.runtime.OfflineInstrumentationAccessGenerator;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+
+/**
+ * Performs offline instrumentation. Note that after execution of test you must
+ * restore original classes with help of "restore-instrumented-classes" goal.
+ * <p>
+ * <strong>Warning:</strong> The preferred way for code coverage analysis with
+ * JaCoCo is on-the-fly instrumentation. Offline instrumentation has several
+ * drawbacks and should only be used if a specific scenario explicitly requires
+ * this mode. Please consult <a href="offline.html">documentation</a> about
+ * offline instrumentation before using this mode.
+ * </p>
+ *
+ * @phase process-classes
+ * @goal instrument
+ * @requiresProject true
+ * @since 0.6.2
+ */
+public class InstrumentMojo extends AbstractJacocoMojo {
+
+ @Override
+ public void executeMojo() throws MojoExecutionException,
+ MojoFailureException {
+ final File originalClassesDir = new File(getProject().getBuild()
+ .getDirectory(), "generated-classes/jacoco");
+ originalClassesDir.mkdirs();
+ final File classesDir = new File(getProject().getBuild()
+ .getOutputDirectory());
+ if (!classesDir.isDirectory()) {
+ getLog().info("skip non existing outputDirectory " + classesDir);
+ return;
+ }
+
+ final List<String> fileNames;
+ try {
+ fileNames = new FileFilter(this.getIncludes(),
+ this.getExcludes()).getFileNames(classesDir);
+ } catch (final IOException e1) {
+ throw new MojoExecutionException(
+ "Unable to get list of files to instrument.", e1);
+ }
+
+ final Instrumenter instrumenter = new Instrumenter(
+ new OfflineInstrumentationAccessGenerator());
+ for (final String fileName : fileNames) {
+ if (fileName.endsWith(".class")) {
+ final File source = new File(classesDir, fileName);
+ final File backup = new File(originalClassesDir, fileName);
+ InputStream input = null;
+ OutputStream output = null;
+ try {
+ FileUtils.copyFile(source, backup);
+ input = new FileInputStream(backup);
+ output = new FileOutputStream(source);
+ instrumenter.instrument(input, output);
+ } catch (final IOException e2) {
+ throw new MojoExecutionException(
+ "Unable to instrument file.", e2);
+ } finally {
+ IOUtil.close(input);
+ IOUtil.close(output);
+ }
+ }
+ }
+ }
+
+}
diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/RestoreMojo.java b/jacoco-maven-plugin/src/org/jacoco/maven/RestoreMojo.java
new file mode 100644
index 00000000..f9e5ecbb
--- /dev/null
+++ b/jacoco-maven-plugin/src/org/jacoco/maven/RestoreMojo.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Mountainminds GmbH & Co. KG and Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Restores original classes as they were before offline instrumentation.
+ *
+ * @phase prepare-package
+ * @goal restore-instrumented-classes
+ * @requiresProject true
+ * @since 0.6.2
+ */
+public class RestoreMojo extends AbstractJacocoMojo {
+
+ @Override
+ protected void executeMojo() throws MojoExecutionException,
+ MojoFailureException {
+ final File originalClassesDir = new File(getProject().getBuild()
+ .getDirectory(), "generated-classes/jacoco");
+ final File classesDir = new File(getProject().getBuild()
+ .getOutputDirectory());
+ try {
+ FileUtils.copyDirectoryStructure(originalClassesDir, classesDir);
+ } catch (final IOException e) {
+ throw new MojoFailureException("Unable to restore classes.", e);
+ }
+ }
+
+}
diff --git a/org.jacoco.doc/docroot/doc/changes.html b/org.jacoco.doc/docroot/doc/changes.html
index 5fc5c247..d1926a79 100644
--- a/org.jacoco.doc/docroot/doc/changes.html
+++ b/org.jacoco.doc/docroot/doc/changes.html
@@ -22,7 +22,7 @@
<h3>New Features</h3>
<ul>
- <li>Support for offline instrumentation (GitHub #4).</li>
+ <li>Support for offline instrumentation (GitHub #4, #64).</li>
<li>JaCoCo agent exposes runtime API for direct integration with application
under test (GitHub #61).</li>
<li>Support for parallel test execution: Different agents can now safely write
diff --git a/org.jacoco.doc/docroot/doc/index.html b/org.jacoco.doc/docroot/doc/index.html
index 7250e249..323ad39a 100644
--- a/org.jacoco.doc/docroot/doc/index.html
+++ b/org.jacoco.doc/docroot/doc/index.html
@@ -41,7 +41,8 @@
<li><a href="examples/build/build.xml">Ant Usage Example</a> -
<a href="examples/build/build-offline.xml">Offline Example</a></li>
<li><a href="maven.html">Maven Plug-in</a></li>
- <li><a href="examples/build/pom.xml">Maven Usage Example</a></li>
+ <li><a href="examples/build/pom.xml">Maven Usage Example</a> -
+ <a href="examples/build/pom-offline.xml">Offline Example</a></li>
<li><a href="agent.html">Java Agent</a></li>
<li><a href="offline.html">Offline Instrumentation</a></li>
<li><a href="faq.html">FAQ</a></li>
diff --git a/org.jacoco.doc/docroot/doc/maven.html b/org.jacoco.doc/docroot/doc/maven.html
index 2c73adcd..0c113116 100644
--- a/org.jacoco.doc/docroot/doc/maven.html
+++ b/org.jacoco.doc/docroot/doc/maven.html
@@ -90,6 +90,8 @@ mvn help:describe -Dplugin=org.jacoco:jacoco-maven-plugin -Ddetail
<li><a href="prepare-agent-mojo.html">prepare-agent</a></li>
<li><a href="report-mojo.html">report</a></li>
<li><a href="check-mojo.html">check</a></li>
+ <li><a href="instrument-mojo.html">instrument</a></li>
+ <li><a href="restore-instrumented-classes-mojo.html">restore-instrumented-classes</a></li>
</ul>
</div>
diff --git a/org.jacoco.examples/build/pom-offline.xml b/org.jacoco.examples/build/pom-offline.xml
new file mode 100644
index 00000000..4a08a5f3
--- /dev/null
+++ b/org.jacoco.examples/build/pom-offline.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2009, 2013 Mountainminds GmbH & Co. KG and Contributors
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Evgeny Mandrikov - initial API and implementation
+-->
+<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>org.jacoco</groupId>
+ <artifactId>org.jacoco.examples.maven</artifactId>
+ <version>@project.version@</version>
+ <packaging>jar</packaging>
+
+ <name>JaCoCo Maven plug-in example with Offline Instrumentation</name>
+ <url>http://www.eclemma.org/jacoco</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.10</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <!-- must be on the classpath -->
+ <groupId>org.jacoco</groupId>
+ <artifactId>org.jacoco.agent</artifactId>
+ <classifier>runtime</classifier>
+ <version>@project.version@</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>instrument</goal>
+ <goal>restore-instrumented-classes</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>report</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>check</id>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <configuration>
+ <check>
+ <classRatio>100</classRatio>
+ <instructionRatio>90</instructionRatio>
+ <methodRatio>95</methodRatio>
+ <branchRatio>85</branchRatio>
+ <complexityRatio>85</complexityRatio>
+ <lineRatio>90</lineRatio>
+ </check>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.12.2</version>
+ <configuration>
+ <systemPropertyVariables>
+ <jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>