Last active
July 2, 2022 13:17
-
-
Save lucidfrontier45/2675d1817b9eba538b86f7c9ed24a76b to your computer and use it in GitHub Desktop.
VSCode and Gradle Settings for Modern Java Development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"recommendations": [ | |
"shengchen.vscode-checkstyle", | |
"sonarsource.sonarlint-vscode", | |
"vscjava.vscode-gradle", | |
"vscjava.vscode-java-pack", | |
"nicolasvuillamy.vscode-groovy-lint", | |
"ilkka.google-java-format" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@org.springframework.lang.NonNullApi | |
package sample; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"[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" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
linter: org.springframework.lang.NonNullApi + SonarLint + CheckStyle(Google Style)
formatter: google-java-format