Skip to content

Commit 2b942ae

Browse files
committed
Skiller ut JaCoCo-/Sonar-greier i egen plugin.
1 parent f34098a commit 2b942ae

File tree

4 files changed

+113
-47
lines changed

4 files changed

+113
-47
lines changed

plugins/java/src/main/groovy/dolly-apps.gradle

+12-25
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
plugins {
2+
id "dolly-sonar"
3+
24
id "io.spring.dependency-management" // See ../../../build.gradle for version.
3-
id "jacoco"
45
id "java"
5-
id "org.sonarqube" // See ../../../build.gradle for version.
66
id "org.springframework.boot" // See ../../../build.gradle for version.
77
}
88

9-
tasks.bootJar {
10-
archiveFileName = "app.jar"
11-
duplicatesStrategy = DuplicatesStrategy.WARN
12-
}
13-
149
configurations {
1510
compileOnly {
1611
extendsFrom annotationProcessor
@@ -42,12 +37,18 @@ dependencies {
4237
dependencyManagement {
4338
applyMavenExclusions = false
4439
imports {
45-
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2023.0.1"
4640
mavenBom "org.springframework.boot:spring-boot-dependencies:3.2.1"
41+
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2023.0.1"
4742
mavenBom "org.springframework.session:spring-session-bom:2021.2.3"
4843
}
4944
}
5045

46+
java {
47+
toolchain {
48+
languageVersion = JavaLanguageVersion.of(21)
49+
}
50+
}
51+
5152
repositories {
5253
mavenCentral()
5354
maven {
@@ -69,23 +70,9 @@ repositories {
6970
mavenLocal()
7071
}
7172

72-
java {
73-
toolchain {
74-
languageVersion = JavaLanguageVersion.of(21)
75-
}
76-
}
77-
78-
sonarqube {
79-
properties {
80-
property "sonar.dynamicAnalysis", "reuseReports"
81-
property "sonar.host.url", "https://sonarcloud.io"
82-
property "sonar.java.coveragePlugin", "jacoco"
83-
property "sonar.language", "java"
84-
property "sonar.organization", "navikt"
85-
property "sonar.project.monorepo.enabled", true
86-
property "sonar.sourceEncoding", "UTF-8"
87-
property "sonar.token", System.getenv("SONAR_TOKEN")
88-
}
73+
tasks.bootJar {
74+
archiveFileName = "app.jar"
75+
duplicatesStrategy = DuplicatesStrategy.WARN
8976
}
9077

9178
tasks.test {

plugins/java/src/main/groovy/dolly-libs.gradle

+8-21
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
plugins {
2+
id "dolly-sonar"
3+
24
id "io.spring.dependency-management" // See ../../../build.gradle for version.
3-
id "jacoco"
45
id "java-library"
5-
id "org.sonarqube" // See ../../../build.gradle for version.
66
}
77

88
group = "no.nav.testnav.libs"
@@ -33,32 +33,19 @@ dependencies {
3333
testImplementation "org.springframework.boot:spring-boot-starter-test"
3434
}
3535

36-
repositories {
37-
mavenCentral()
38-
maven {
39-
name = "Confluent"
40-
url = uri("https://packages.confluent.io/maven/")
41-
}
42-
mavenLocal()
43-
}
44-
4536
java {
4637
toolchain {
4738
languageVersion = JavaLanguageVersion.of(21)
4839
}
4940
}
5041

51-
sonarqube {
52-
properties {
53-
property "sonar.dynamicAnalysis", "reuseReports"
54-
property "sonar.host.url", "https://sonarcloud.io"
55-
property "sonar.java.coveragePlugin", "jacoco"
56-
property "sonar.language", "java"
57-
property "sonar.organization", "navikt"
58-
property "sonar.project.monorepo.enabled", true
59-
property "sonar.sourceEncoding", "UTF-8"
60-
property "sonar.token", System.getenv("SONAR_TOKEN")
42+
repositories {
43+
mavenCentral()
44+
maven {
45+
name = "Confluent"
46+
url = uri("https://packages.confluent.io/maven/")
6147
}
48+
mavenLocal()
6249
}
6350

6451
tasks.test {
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,84 @@
1+
plugins {
2+
id "dolly-sonar"
3+
4+
id "io.spring.dependency-management" // See ../../../build.gradle for version.
5+
id "java"
6+
id "org.springframework.boot" // See ../../../build.gradle for version.
7+
}
8+
9+
configurations {
10+
compileOnly {
11+
extendsFrom annotationProcessor
12+
}
13+
}
14+
115
dependencies {
16+
annotationProcessor "org.projectlombok:lombok"
17+
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
18+
19+
compileOnly "org.projectlombok:lombok"
20+
21+
developmentOnly "org.springframework.boot:spring-boot-devtools"
22+
23+
implementation "net.logstash.logback:logstash-logback-encoder:7.4"
224
implementation "no.nav.testnav.libs:reactive-core"
325
implementation "no.nav.testnav.libs:reactive-proxy"
4-
26+
implementation "org.hibernate.validator:hibernate-validator"
27+
implementation "org.projectlombok:lombok"
28+
implementation "org.springframework.boot:spring-boot-starter-actuator"
529
implementation "org.springframework.boot:spring-boot-starter-oauth2-resource-server"
630
implementation "org.springframework.cloud:spring-cloud-starter-gateway"
731

32+
runtimeOnly "io.micrometer:micrometer-registry-prometheus"
33+
34+
testAnnotationProcessor "org.projectlombok:lombok"
35+
36+
testImplementation "org.springframework.boot:spring-boot-starter-test"
837
testImplementation "org.springframework.cloud:spring-cloud-contract-wiremock"
38+
}
39+
40+
dependencyManagement {
41+
applyMavenExclusions = false
42+
imports {
43+
mavenBom "org.springframework.boot:spring-boot-dependencies:3.2.1"
44+
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2023.0.1"
45+
mavenBom "org.springframework.session:spring-session-bom:2021.2.3"
46+
}
47+
}
48+
49+
java {
50+
toolchain {
51+
languageVersion = JavaLanguageVersion.of(21)
52+
}
53+
}
54+
55+
repositories {
56+
mavenCentral()
57+
maven {
58+
name = "GitHub Packages"
59+
url = uri("https://maven.pkg.github.com/navikt/maven-release")
60+
credentials(PasswordCredentials) {
61+
username "token"
62+
password System.getenv("NAV_TOKEN")
63+
}
64+
}
65+
maven {
66+
name = "Confluent"
67+
url = uri("https://packages.confluent.io/maven/")
68+
}
69+
maven {
70+
name = "Shibboleth"
71+
url = uri("https://build.shibboleth.net/maven/releases/")
72+
}
73+
mavenLocal()
74+
}
75+
76+
tasks.bootJar {
77+
archiveFileName = "app.jar"
78+
duplicatesStrategy = DuplicatesStrategy.WARN
79+
}
80+
81+
tasks.test {
82+
useJUnitPlatform()
83+
jvmArgs "--add-opens", "java.base/java.lang=ALL-UNNAMED"
984
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
plugins {
2+
id "jacoco"
3+
id "org.sonarqube" // See ../../../build.gradle for version.
4+
}
5+
6+
sonarqube {
7+
properties {
8+
property "sonar.dynamicAnalysis", "reuseReports"
9+
property "sonar.host.url", "https://sonarcloud.io"
10+
property "sonar.java.coveragePlugin", "jacoco"
11+
property "sonar.language", "java"
12+
property "sonar.organization", "navikt"
13+
property "sonar.project.monorepo.enabled", true
14+
property "sonar.sourceEncoding", "UTF-8"
15+
property "sonar.token", System.getenv("SONAR_TOKEN")
16+
}
17+
}

0 commit comments

Comments
 (0)