Skip to content

Commit 3e543dd

Browse files
committed
CDM-94 Add JaCoCo code coverage plugin and set for minimum coverage percentage or else fail the build
1 parent 4cf5667 commit 3e543dd

File tree

6 files changed

+124
-0
lines changed

6 files changed

+124
-0
lines changed

.classpath

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/resources">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15+
<attributes>
16+
<attribute name="optional" value="true"/>
17+
<attribute name="maven.pomderived" value="true"/>
18+
<attribute name="test" value="true"/>
19+
</attributes>
20+
</classpathentry>
21+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
22+
<attributes>
23+
<attribute name="maven.pomderived" value="true"/>
24+
</attributes>
25+
</classpathentry>
26+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
27+
<attributes>
28+
<attribute name="maven.pomderived" value="true"/>
29+
</attributes>
30+
</classpathentry>
31+
<classpathentry kind="output" path="target/classes"/>
32+
</classpath>

.project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>datastax.cdm.cassandra-data-migrator-4.1.5-SNAPSHOT</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
encoding//src/main/java=UTF-8
3+
encoding//src/resources=UTF-8
4+
encoding//src/test/java=UTF-8
5+
encoding/<project>=UTF-8

.settings/org.eclipse.jdt.core.prefs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
3+
org.eclipse.jdt.core.compiler.compliance=1.8
4+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
5+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
7+
org.eclipse.jdt.core.compiler.release=disabled
8+
org.eclipse.jdt.core.compiler.source=1.8

.settings/org.eclipse.m2e.core.prefs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

pom.xml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,58 @@
225225
<target>1.8</target>
226226
</configuration>
227227
</plugin>
228+
229+
<!-- Integrate JaCoCo code coverage plugin from https://www.eclemma.org/jacoco/trunk/doc/index.html -->
230+
<plugin>
231+
<groupId>org.jacoco</groupId>
232+
<artifactId>jacoco-maven-plugin</artifactId>
233+
<version>0.8.10</version>
234+
<executions>
235+
<execution>
236+
<goals>
237+
<goal>prepare-agent</goal>
238+
</goals>
239+
</execution>
240+
<execution>
241+
<id>report</id>
242+
<phase>prepare-package</phase>
243+
<goals>
244+
<goal>report</goal>
245+
</goals>
246+
</execution>
247+
<execution>
248+
<id>jacoco-check</id>
249+
<goals>
250+
<goal>check</goal>
251+
</goals>
252+
<configuration>
253+
<rules>
254+
<rule>
255+
<element>BUNDLE</element>
256+
<limits>
257+
<limit>
258+
<counter>COMPLEXITY</counter>
259+
<value>COVEREDRATIO</value>
260+
<minimum>0.33</minimum>
261+
</limit>
262+
<limit>
263+
<counter>INSTRUCTION</counter>
264+
<value>COVEREDRATIO</value>
265+
<minimum>42%</minimum>
266+
</limit>
267+
<limit>
268+
<counter>LINE</counter>
269+
<value>MISSEDCOUNT</value>
270+
<maximum>1544</maximum>
271+
</limit>
272+
</limits>
273+
</rule>
274+
</rules>
275+
</configuration>
276+
</execution>
277+
</executions>
278+
</plugin>
279+
228280
</plugins>
229281
</build>
230282
</project>

0 commit comments

Comments
 (0)