Created
July 6, 2020 00:35
-
-
Save rhamedy/85a0a2b4642a18015220037ce195a647 to your computer and use it in GitHub Desktop.
Java Spring Boot with JaCoCo Code Coverage with Gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id 'org.springframework.boot' version '2.3.1.RELEASE' | |
id 'io.spring.dependency-management' version '1.0.9.RELEASE' | |
id 'java' | |
id 'eclipse' | |
id 'jacoco' | |
} | |
group = 'codecov.article' | |
version = '0.0.1-SNAPSHOT' | |
sourceCompatibility = '1.8' | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
implementation 'org.springframework.boot:spring-boot-starter-web' | |
testImplementation('org.springframework.boot:spring-boot-starter-test') { | |
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' | |
} | |
} | |
test { | |
finalizedBy jacocoTestReport // report is always generated after tests run | |
} | |
jacocoTestReport { | |
dependsOn test // tests are required to run before generating the report | |
} | |
jacoco { | |
toolVersion = "0.8.5" | |
reportsDir = file("$buildDir/jacoco") | |
} | |
test { | |
useJUnitPlatform() | |
} | |
jacocoTestCoverageVerification { | |
violationRules { | |
rule { | |
limit { | |
minimum = 1 | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for exmplain