Skip to content

Instantly share code, notes, and snippets.

@lucidfrontier45
Last active July 2, 2022 13:17
Show Gist options
  • Save lucidfrontier45/2675d1817b9eba538b86f7c9ed24a76b to your computer and use it in GitHub Desktop.
Save lucidfrontier45/2675d1817b9eba538b86f7c9ed24a76b to your computer and use it in GitHub Desktop.
VSCode and Gradle Settings for Modern Java Development
plugins {
id 'java'
id "jacoco"
id "com.diffplug.spotless" version "6.7.2"
}
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
implementation 'org.springframework:spring-core:5.3.21'
}
tasks.named('test') {
useJUnitPlatform()
}
spotless {
java {
googleJavaFormat('1.15.0')
target 'src/*/java/**/*.java', 'modules/**/src/*/java/**/*.java'
}
}
tasks.named("test") {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
test {
finalizedBy jacocoTestReport // report is always generated after tests run
}
jacoco {
toolVersion = "0.8.7"
}
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
reports {
html.required = true
csv.required = false
xml.required = true
}
}
{
"recommendations": [
"shengchen.vscode-checkstyle",
"sonarsource.sonarlint-vscode",
"vscjava.vscode-gradle",
"vscjava.vscode-java-pack",
"nicolasvuillamy.vscode-groovy-lint",
"ilkka.google-java-format"
]
}
@org.springframework.lang.NonNullApi
package sample;
{
"[groovy]": {
"editor.defaultFormatter": "NicolasVuillamy.vscode-groovy-lint"
},
"[java]": {
"editor.defaultFormatter": "ilkka.google-java-format"
},
"coverage-gutters.coverageFileNames": [
"cov.xml",
"coverage.xml",
"jacoco.xml",
"coverage.cobertura.xml",
"jacocoTestReport.xml"
],
"coverage-gutters.coverageReportFileName": "",
"editor.formatOnSave": true,
"google-java-format.executable-path": "/usr/local/bin/google-java-format-1.15.0-linux-x86_64",
"java.checkstyle.configuration": "${workspaceFolder}/google_checks-10.3.1.xml",
"java.checkstyle.version": "10.3.1",
"java.configuration.updateBuildConfiguration": "automatic"
}
@lucidfrontier45
Copy link
Author

lucidfrontier45 commented Jun 27, 2022

linter: org.springframework.lang.NonNullApi + SonarLint + CheckStyle(Google Style)
formatter: google-java-format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment