File tree Expand file tree Collapse file tree 5 files changed +17
-15
lines changed
main/kotlin/com/willmolloy
test/kotlin/com/willmolloy Expand file tree Collapse file tree 5 files changed +17
-15
lines changed Original file line number Diff line number Diff line change 33[ ![ build] ( https://github.com/will-molloy/java-template/actions/workflows/build.yml/badge.svg?branch=main&event=push )] ( https://github.com/will-molloy/java-template/actions/workflows/build.yml )
44[ ![ codecov] ( https://codecov.io/gh/will-molloy/java-template/branch/main/graph/badge.svg )] ( https://codecov.io/gh/will-molloy/java-template )
55
6- template repo for Java/Kotlin projects using Gradle
6+ template repo for Java/Kotlin Gradle projects
77
88## Features
99
1010- JDK 21 ([ Amazon Corretto] ( https://aws.amazon.com/corretto/ ) )
11- - [ Gradle 8] ( https://github.com/gradle/gradle ) with Kotlin DSL
11+ - [ Gradle 8] ( https://github.com/gradle/gradle ) ( Kotlin DSL)
1212- [ GitHub Actions] ( https://github.com/features/actions ) CI/CD
13- - Automatic code formatting via [ Spotless] ( https://github.com/diffplug/spotless ) ([ ` google-java-format ` ] ( https://github.com/google/google-java-format ) and [ ` ktlint ` ] ( https://github.com/pinterest/ktlint ) )
13+ - Automatic code formatting via [ Spotless] ( https://github.com/diffplug/spotless )
14+ - Java: [ ` google-java-format ` ] ( https://github.com/google/google-java-format )
15+ - Kotlin: [ ` ktfmt ` ] ( https://github.com/facebook/ktfmt )
16+ - Kotlin Gradle: [ ` ktlint ` ] ( https://github.com/pinterest/ktlint )
1417- Code style analysis via [ Checkstyle] ( https://github.com/checkstyle/checkstyle )
1518- Static analysis via [ SpotBugs] ( https://spotbugs.github.io/ )
1619- Unit and integration test support via [ JUnit 5] ( https://junit.org/junit5/ ) and [ TestSets plugin] ( https://github.com/unbroken-dome/gradle-testsets-plugin )
Original file line number Diff line number Diff line change @@ -37,14 +37,16 @@ allprojects {
3737
3838 apply (plugin = " com.diffplug.spotless" )
3939 configure<SpotlessExtension > {
40+ // https://github.com/diffplug/spotless/tree/main/plugin-gradle#java
4041 java {
4142 removeUnusedImports()
4243 googleJavaFormat()
4344 trimTrailingWhitespace()
4445 endWithNewline()
4546 }
47+ // https://github.com/diffplug/spotless/tree/main/plugin-gradle#kotlin
4648 kotlin {
47- ktlint ()
49+ ktfmt().googleStyle ()
4850 trimTrailingWhitespace()
4951 endWithNewline()
5052 }
@@ -55,7 +57,7 @@ allprojects {
5557 }
5658 }
5759
58- // TODO this doesn't work on Kotlin, look into Detekt ?
60+ // TODO Kotlin alternative ?
5961 apply (plugin = " checkstyle" )
6062 configure<CheckstyleExtension > {
6163 toolVersion = " 10.12.0"
@@ -137,7 +139,8 @@ allprojects {
137139 exclude(group = " org.assertj" )
138140 exclude(group = " junit" )
139141 resolutionStrategy {
140- force(" com.google.guava:guava:${rootProject.libs.versions.guava.get()} " ) // exclude android version
142+ // exclude android version
143+ force(" com.google.guava:guava:${rootProject.libs.versions.guava.get()} " )
141144 }
142145 }
143146 }
Original file line number Diff line number Diff line change 1- plugins {
2- alias(libs.plugins.testsets)
3- }
1+ plugins { alias(libs.plugins.testsets) }
42
5- testSets {
6- create(" integrationTest" )
7- }
3+ testSets { create(" integrationTest" ) }
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ package com.willmolloy
66 * @author <a href=https://willmolloy.com>Will Molloy</a>
77 */
88class HelloWorld {
9+
910 fun hello (text : String ): String {
1011 return " Hello $text !"
1112 }
Original file line number Diff line number Diff line change @@ -3,10 +3,9 @@ package com.willmolloy
33import com.google.common.truth.Truth.assertThat
44import org.junit.jupiter.api.Test
55
6- /* *
7- * Unit tests for [HelloWorld].
8- */
6+ /* * Unit tests for [HelloWorld]. */
97class HelloWorldTest {
8+
109 @Test
1110 fun `test hello` () {
1211 assertThat(HelloWorld ().hello(" world" )).isEqualTo(" Hello world!" )
You can’t perform that action at this time.
0 commit comments