This repository has been archived by the owner on May 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
/
fahrschein.java-conventions.gradle
78 lines (66 loc) · 2.4 KB
/
fahrschein.java-conventions.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
plugins {
id 'java-library'
id 'jacoco'
id 'org.owasp.dependencycheck'
id 'de.thetaphi.forbiddenapis'
}
repositories {
mavenCentral()
}
group = 'org.zalando'
version = project.property('project.version') + (project.hasProperty('release') ? '' : '-SNAPSHOT')
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs << '-parameters'
options.compilerArgs << '-Xlint:all'
options.encoding = 'UTF-8'
options.release = Integer.valueOf(project.property("jdk.version"))
}
dependencies {
implementation("org.slf4j:slf4j-api:${property('slf4j.version')}") {
because "we want slf4j-api to be available everywhere"
}
// JUnit 5
testImplementation("org.junit.jupiter:junit-jupiter:${property('junit.version')}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${property('junit.version')}")
testImplementation("org.mockito:mockito-junit-jupiter:${property('mockito.version')}")
testImplementation("org.mockito:mockito-core:${property('mockito.version')}") {
because "We want Mockito to be used in tests"
}
testImplementation('org.hamcrest:hamcrest:2.2') {
because "we want to have hamcrest available for all testing"
}
compileOnly('com.google.code.findbugs:jsr305:3.0.2') {
because "we want to have annotations like @Deprecated available at compilation time"
}
testCompileOnly('com.google.code.findbugs:jsr305:3.0.2') {
because "we also have some findbugs annotations in test code"
}
}
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(platform(module('commons-logging:commons-logging'))).
using module("org.slf4j:jcl-over-slf4j:${property('slf4j.version')}")
// hamcrest changed package coordinates. Make sure to only include the new one.
substitute(platform(module('org.hamcrest:hamcrest-core'))).
using module("org.hamcrest:hamcrest:2.2")
}
}
test {
useJUnitPlatform()
}
tasks.named('test') {
finalizedBy tasks.named('jacocoTestReport', JacocoReport)
}
forbiddenApisMain {
bundledSignatures = [ 'jdk-unsafe', 'jdk-deprecated', 'jdk-non-portable', 'jdk-reflection' ]
ignoreFailures = false
}
forbiddenApisTest {
bundledSignatures = [ 'jdk-unsafe', 'jdk-deprecated', 'jdk-reflection' ]
ignoreFailures = true
}