Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/java-conventions-plugin #3503

Merged
merged 4 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 1 addition & 71 deletions apps/budpro-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,106 +1,36 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.1'
id 'io.spring.dependency-management' version '1.1.4'
id "jacoco"
id "org.sonarqube" version "5.0.0.4638"
id "dolly-java-conventions"
id("org.openrewrite.rewrite") version("6.6.4")
}

bootJar {
archiveFileName = "app.jar"
mainClass = 'no.nav.dolly.budpro.BudproServiceApplication'
}

rewrite {
activeRecipe("org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_2")
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

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

repositories {
mavenCentral()
mavenLocal()
maven {
name = "GitHubPackages"
url = uri('https://maven.pkg.github.com/navikt/maven-release')
credentials(PasswordCredentials) {
username 'token'
password System.getenv("NAV_TOKEN")
}
}
}

dependencyManagement {
applyMavenExclusions = false
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2023.0.0"
}
}

dependencies {
rewrite('org.openrewrite.recipe:rewrite-spring:5.10.0')

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:commands'
implementation 'no.nav.testnav.libs:data-transfer-objects'
implementation 'no.nav.testnav.libs:reactive-core'
implementation 'no.nav.testnav.libs:security-core'
implementation 'no.nav.testnav.libs:servlet-core'
implementation 'no.nav.testnav.libs:servlet-insecure-security'
implementation 'no.nav.testnav.libs:servlet-security'
implementation 'org.projectlombok:lombok'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.cloud:spring-cloud-starter-vault-config'

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

testAnnotationProcessor 'org.projectlombok:lombok'

testImplementation "org.junit.jupiter:junit-jupiter:5.10.1"
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.testcontainers:junit-jupiter'
}

test {
useJUnitPlatform()
jvmArgs '--add-opens', 'java.base/java.lang=ALL-UNNAMED'
}

sonarqube {
properties {
property "sonar.dynamicAnalysis", "reuseReports"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.language", "java"
property "sonar.token", System.getenv("SONAR_TOKEN")
property "sonar.organization", "navikt"
property "sonar.project.monorepo.enabled", true
property "sonar.projectKey", "testnav-budpro-service"
property "sonar.projectName", "testnav-budpro-service"
property "sonar.sourceEncoding", "UTF-8"
}
}
2 changes: 2 additions & 0 deletions apps/budpro-service/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ plugins {

rootProject.name = 'budpro-service'

includeBuild '../../plugins/java'

includeBuild '../../libs/commands'
includeBuild '../../libs/data-transfer-objects'
includeBuild '../../libs/reactive-core'
Expand Down
13 changes: 13 additions & 0 deletions plugins/java/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
id "groovy-gradle-plugin"
}

repositories {
gradlePluginPortal()
}

dependencies {
implementation "io.spring.gradle:dependency-management-plugin:1.1.4"
implementation "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:5.0.0.4638"
implementation "org.springframework.boot:spring-boot-gradle-plugin:3.2.1"
}
Empty file added plugins/java/settings.gradle
Empty file.
81 changes: 81 additions & 0 deletions plugins/java/src/main/groovy/dolly-java-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
plugins {
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"
}

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 'org.projectlombok:lombok'
implementation 'org.springframework.boot:spring-boot-starter-actuator'

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

testAnnotationProcessor 'org.projectlombok:lombok'

testImplementation "org.junit.jupiter:junit-jupiter:5.10.1"
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

dependencyManagement {
applyMavenExclusions = false
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2023.0.0"
}
}

repositories {
mavenLocal()
mavenCentral()
maven {
name = "GitHubPackages"
url = uri('https://maven.pkg.github.com/navikt/maven-release')
credentials(PasswordCredentials) {
username 'token'
password System.getenv("NAV_TOKEN")
}
}
}

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.token", System.getenv("SONAR_TOKEN")
property "sonar.organization", "navikt"
property "sonar.project.monorepo.enabled", true
property "sonar.sourceEncoding", "UTF-8"
}
}

tasks.test {
useJUnitPlatform()
jvmArgs '--add-opens', 'java.base/java.lang=ALL-UNNAMED'
}
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ develocity {
}
}

includeBuild './plugins/java'

includeBuild './proxies/aareg-proxy'
includeBuild './proxies/aareg-synt-services-proxy'
includeBuild './proxies/arbeidsplassencv-proxy'
Expand Down