Skip to content

Commit

Permalink
Skiller ut JaCoCo-/Sonar-greier i egen plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
rfc3092 committed Jun 18, 2024
1 parent f34098a commit 2b942ae
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 47 deletions.
37 changes: 12 additions & 25 deletions plugins/java/src/main/groovy/dolly-apps.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
plugins {
id "dolly-sonar"

id "io.spring.dependency-management" // See ../../../build.gradle for version.
id "jacoco"
id "java"
id "org.sonarqube" // See ../../../build.gradle for version.
id "org.springframework.boot" // See ../../../build.gradle for version.
}

tasks.bootJar {
archiveFileName = "app.jar"
duplicatesStrategy = DuplicatesStrategy.WARN
}

configurations {
compileOnly {
extendsFrom annotationProcessor
Expand Down Expand Up @@ -42,12 +37,18 @@ dependencies {
dependencyManagement {
applyMavenExclusions = false
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2023.0.1"
mavenBom "org.springframework.boot:spring-boot-dependencies:3.2.1"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2023.0.1"
mavenBom "org.springframework.session:spring-session-bom:2021.2.3"
}
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

repositories {
mavenCentral()
maven {
Expand All @@ -69,23 +70,9 @@ repositories {
mavenLocal()
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

sonarqube {
properties {
property "sonar.dynamicAnalysis", "reuseReports"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.language", "java"
property "sonar.organization", "navikt"
property "sonar.project.monorepo.enabled", true
property "sonar.sourceEncoding", "UTF-8"
property "sonar.token", System.getenv("SONAR_TOKEN")
}
tasks.bootJar {
archiveFileName = "app.jar"
duplicatesStrategy = DuplicatesStrategy.WARN
}

tasks.test {
Expand Down
29 changes: 8 additions & 21 deletions plugins/java/src/main/groovy/dolly-libs.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id "dolly-sonar"

id "io.spring.dependency-management" // See ../../../build.gradle for version.
id "jacoco"
id "java-library"
id "org.sonarqube" // See ../../../build.gradle for version.
}

group = "no.nav.testnav.libs"
Expand Down Expand Up @@ -33,32 +33,19 @@ dependencies {
testImplementation "org.springframework.boot:spring-boot-starter-test"
}

repositories {
mavenCentral()
maven {
name = "Confluent"
url = uri("https://packages.confluent.io/maven/")
}
mavenLocal()
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

sonarqube {
properties {
property "sonar.dynamicAnalysis", "reuseReports"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.language", "java"
property "sonar.organization", "navikt"
property "sonar.project.monorepo.enabled", true
property "sonar.sourceEncoding", "UTF-8"
property "sonar.token", System.getenv("SONAR_TOKEN")
repositories {
mavenCentral()
maven {
name = "Confluent"
url = uri("https://packages.confluent.io/maven/")
}
mavenLocal()
}

tasks.test {
Expand Down
77 changes: 76 additions & 1 deletion plugins/java/src/main/groovy/dolly-proxies.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,84 @@
plugins {
id "dolly-sonar"

id "io.spring.dependency-management" // See ../../../build.gradle for version.
id "java"
id "org.springframework.boot" // See ../../../build.gradle for version.
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

dependencies {
annotationProcessor "org.projectlombok:lombok"
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"

compileOnly "org.projectlombok:lombok"

developmentOnly "org.springframework.boot:spring-boot-devtools"

implementation "net.logstash.logback:logstash-logback-encoder:7.4"
implementation "no.nav.testnav.libs:reactive-core"
implementation "no.nav.testnav.libs:reactive-proxy"

implementation "org.hibernate.validator:hibernate-validator"
implementation "org.projectlombok:lombok"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-oauth2-resource-server"
implementation "org.springframework.cloud:spring-cloud-starter-gateway"

runtimeOnly "io.micrometer:micrometer-registry-prometheus"

testAnnotationProcessor "org.projectlombok:lombok"

testImplementation "org.springframework.boot:spring-boot-starter-test"
testImplementation "org.springframework.cloud:spring-cloud-contract-wiremock"
}

dependencyManagement {
applyMavenExclusions = false
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:3.2.1"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2023.0.1"
mavenBom "org.springframework.session:spring-session-bom:2021.2.3"
}
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

repositories {
mavenCentral()
maven {
name = "GitHub Packages"
url = uri("https://maven.pkg.github.com/navikt/maven-release")
credentials(PasswordCredentials) {
username "token"
password System.getenv("NAV_TOKEN")
}
}
maven {
name = "Confluent"
url = uri("https://packages.confluent.io/maven/")
}
maven {
name = "Shibboleth"
url = uri("https://build.shibboleth.net/maven/releases/")
}
mavenLocal()
}

tasks.bootJar {
archiveFileName = "app.jar"
duplicatesStrategy = DuplicatesStrategy.WARN
}

tasks.test {
useJUnitPlatform()
jvmArgs "--add-opens", "java.base/java.lang=ALL-UNNAMED"
}
17 changes: 17 additions & 0 deletions plugins/java/src/main/groovy/dolly-sonar.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
plugins {
id "jacoco"
id "org.sonarqube" // See ../../../build.gradle for version.
}

sonarqube {
properties {
property "sonar.dynamicAnalysis", "reuseReports"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.language", "java"
property "sonar.organization", "navikt"
property "sonar.project.monorepo.enabled", true
property "sonar.sourceEncoding", "UTF-8"
property "sonar.token", System.getenv("SONAR_TOKEN")
}
}

0 comments on commit 2b942ae

Please sign in to comment.