Skip to content

Commit d51bc8b

Browse files
authored
Merge pull request #10838 from ukhan1980/BAEL-4406-jacoco-exclusions
[BAEL-4406] Add JaCoCo exclusions
2 parents bf5b25b + 70514c9 commit d51bc8b

30 files changed

Lines changed: 577 additions & 0 deletions

File tree

gradle/gradle-jacoco/build.gradle

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
plugins {
3+
id 'java'
4+
id 'jacoco'
5+
}
6+
7+
ext {
8+
junitVersion = '5.7.2'
9+
lombokVersion = '1.18.20'
10+
}
11+
12+
group 'com.com.baeldung'
13+
version '1.0-SNAPSHOT'
14+
15+
repositories {
16+
mavenCentral()
17+
}
18+
19+
java {
20+
sourceCompatibility = JavaVersion.VERSION_11
21+
targetCompatibility = JavaVersion.VERSION_11
22+
}
23+
24+
dependencies {
25+
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
26+
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
27+
28+
compileOnly "org.projectlombok:lombok:${lombokVersion}"
29+
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
30+
}
31+
32+
test {
33+
useJUnitPlatform()
34+
35+
finalizedBy jacocoTestReport // report is always generated after tests run
36+
}
37+
38+
jacocoTestReport {
39+
dependsOn test // tests are required to run before generating the report
40+
41+
afterEvaluate {
42+
classDirectories.setFrom(files(classDirectories.files.collect {
43+
fileTree(dir: it, exclude: [
44+
"com/baeldung/**/ExcludedPOJO.class",
45+
"com/baeldung/**/*DTO.*",
46+
"**/config/*"
47+
])
48+
}))
49+
}
50+
}
51+
52+
jacoco {
53+
toolVersion = "0.8.6"
54+
}
57.8 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

gradle/gradle-jacoco/gradlew

Lines changed: 185 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradle/gradle-jacoco/gradlew.bat

Lines changed: 89 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradle/gradle-jacoco/lombok.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lombok.addLombokGeneratedAnnotation = true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'gradle-jacoco'
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.baeldung.config;
2+
3+
import com.baeldung.service.ProductService;
4+
5+
public class AppConfig {
6+
7+
public ProductService productService() {
8+
return new ProductService();
9+
}
10+
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.baeldung.domain;
2+
3+
import lombok.Builder;
4+
import lombok.Data;
5+
6+
@Builder
7+
@Data
8+
public class Product {
9+
private int id;
10+
private String name;
11+
12+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package com.baeldung.dto;
2+
3+
public class ExcludedPOJO {
4+
}

0 commit comments

Comments
 (0)