|
| 1 | +plugins { |
| 2 | + // Apply the application plugin to add support for building a CLI application in Java. |
| 3 | + application |
| 4 | + eclipse |
| 5 | + id("com.diffplug.spotless") version "6.25.0" |
| 6 | + id("org.springframework.boot") version "3.2.2" |
| 7 | + id("com.adarshr.test-logger") version "4.0.0" |
| 8 | + id("io.freefair.lombok") version "8.6" |
| 9 | +} |
| 10 | + |
| 11 | +apply(plugin = "io.spring.dependency-management") |
| 12 | + |
| 13 | +repositories { |
| 14 | + // Use Maven Central for resolving dependencies. |
| 15 | + mavenCentral() |
| 16 | +} |
| 17 | + |
| 18 | +dependencies { |
| 19 | + // Use JUnit Jupiter for testing. |
| 20 | + testImplementation("com.codedifferently.instructional:instructional-lib") |
| 21 | + testImplementation("org.junit.jupiter:junit-jupiter:5.9.1") |
| 22 | + testImplementation("org.springframework.boot:spring-boot-starter-test") |
| 23 | + testImplementation("org.assertj:assertj-core:3.25.1") |
| 24 | + testImplementation("at.favre.lib:bcrypt:0.10.2") |
| 25 | + |
| 26 | + // This dependency is used by the application. |
| 27 | + implementation("com.codedifferently.instructional:instructional-lib") |
| 28 | + implementation("com.google.guava:guava:31.1-jre") |
| 29 | + implementation("com.google.code.gson:gson:2.10.1") |
| 30 | + implementation("commons-cli:commons-cli:1.6.0") |
| 31 | + implementation("org.springframework.boot:spring-boot-starter") |
| 32 | + implementation("org.springframework.boot:spring-boot-starter-data-jpa") |
| 33 | + implementation("com.fasterxml.jackson.core:jackson-databind:2.13.0") |
| 34 | + implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.3") |
| 35 | + implementation("com.opencsv:opencsv:5.9") |
| 36 | + implementation("org.apache.commons:commons-csv:1.10.0") |
| 37 | + implementation("org.xerial:sqlite-jdbc:3.36.0") |
| 38 | + implementation("org.hibernate.orm:hibernate-community-dialects:6.2.7.Final") |
| 39 | +} |
| 40 | + |
| 41 | +application { |
| 42 | + // Define the main class for the application. |
| 43 | + mainClass.set("com.codedifferently.lesson28.Lesson28") |
| 44 | +} |
| 45 | + |
| 46 | +tasks.named<JavaExec>("run") { |
| 47 | + standardInput = System.`in` |
| 48 | +} |
| 49 | + |
| 50 | +tasks.named<Test>("test") { |
| 51 | + // Use JUnit Platform for unit tests. |
| 52 | + useJUnitPlatform() |
| 53 | +} |
| 54 | + |
| 55 | + |
| 56 | +configure<com.diffplug.gradle.spotless.SpotlessExtension> { |
| 57 | + |
| 58 | + format("misc", { |
| 59 | + // define the files to apply `misc` to |
| 60 | + target("*.gradle", ".gitattributes", ".gitignore") |
| 61 | + |
| 62 | + // define the steps to apply to those files |
| 63 | + trimTrailingWhitespace() |
| 64 | + indentWithTabs() // or spaces. Takes an integer argument if you don't like 4 |
| 65 | + endWithNewline() |
| 66 | + }) |
| 67 | + |
| 68 | + java { |
| 69 | + // don't need to set target, it is inferred from java |
| 70 | + |
| 71 | + // apply a specific flavor of google-java-format |
| 72 | + googleJavaFormat() |
| 73 | + // fix formatting of type annotations |
| 74 | + formatAnnotations() |
| 75 | + } |
| 76 | +} |
0 commit comments