aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2022-02-24 21:03:35 +0000
committerterminaldweller <thabogre@gmail.com>2022-02-24 21:03:35 +0000
commit0d4fcd1f7066cf8dca5333c39179659e65915e78 (patch)
treebcf701ad8222e99206c4756e88a5d526457ac700
parentupdates (diff)
downloadmdrtl-0d4fcd1f7066cf8dca5333c39179659e65915e78.tar.gz
mdrtl-0d4fcd1f7066cf8dca5333c39179659e65915e78.zip
updates
-rw-r--r--build.gradle.kts53
-rw-r--r--settings.gradle.kts2
-rw-r--r--src/main/java/com/terminaldweller/main/MainApplication.java25
-rw-r--r--src/main/java/hello/Greeter.java6
-rw-r--r--src/main/java/hello/HelloWorld.java8
5 files changed, 68 insertions, 26 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index 6438891..82758e1 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,22 +1,53 @@
-/*
- * This file was generated by the Gradle 'init' task.
- *
- * This is a general purpose Gradle build.
- * Learn more about Gradle by exploring our samples at https://docs.gradle.org/7.3.3/samples
- * This project uses @Incubating APIs which are subject to change.
- */
-
+ /*https://docs.gradle.org/current/userguide/building_java_projects.html*/
plugins {
`java-library`
+ // application
+ id("org.springframework.boot") version "2.6.4"
+ id("io.spring.dependency-management") version "1.0.11.RELEASE"
+ id("java")
+ }
+
+
+ repositories {
+ mavenCentral()
}
sourceSets {
main {
- java.srcDir("src/main/java/hello")
+ java {
+ setSrcDirs(listOf("src"))
+ }
+ }
+
+ test {
+ java {
+ setSrcDirs(listOf("test"))
+ }
}
}
java {
- sourceCompatibility = JavaVersion.VERSION_11
- targetCompatibility = JavaVersion.VERSION_11
+ // sourceCompatibility = JavaVersion.VERSION_11
+ // targetCompatibility = JavaVersion.VERSION_11
+ toolchain {
+ languageVersion.set(JavaLanguageVersion.of(11))
+ }
}
+
+ // application {
+ // mainClass.set("com.terminaldweller.Main")
+ // }
+
+ tasks.compileJava {
+ options.isIncremental = true
+ options.isFork = true
+ options.isFailOnError = false
+ options.release.set(11)
+ }
+
+ dependencies {
+ implementation("org.springframework.boot:spring-boot-starter-data-jdbc")
+ implementation("org.springframework.boot:spring-boot-starter-web")
+ runtimeOnly("org.postgresql:postgresql")
+ testImplementation("org.springframework.boot:spring-boot-starter-test")
+ }
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 47b4983..d5ae214 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -8,4 +8,4 @@
* This project uses @Incubating APIs which are subject to change.
*/
-rootProject.name = "main"
+rootProject.name = "src"
diff --git a/src/main/java/com/terminaldweller/main/MainApplication.java b/src/main/java/com/terminaldweller/main/MainApplication.java
new file mode 100644
index 0000000..3738769
--- /dev/null
+++ b/src/main/java/com/terminaldweller/main/MainApplication.java
@@ -0,0 +1,25 @@
+package com.terminaldweller.main;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/** The main class. */
+@SpringBootApplication
+@RestController
+public class MainApplication {
+ @RequestMapping("/")
+ public String home() {
+ return "Hello Docker World";
+ }
+
+ /**
+ * just a dummy main.
+ *
+ * @param args just the argv
+ */
+ public static void main(String[] args) {
+ SpringApplication.run(MainApplication.class, args);
+ }
+}
diff --git a/src/main/java/hello/Greeter.java b/src/main/java/hello/Greeter.java
deleted file mode 100644
index 668f8fe..0000000
--- a/src/main/java/hello/Greeter.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package hello;
-public class Greeter {
- public String sayHello() {
- return "Hello World!";
- }
-}
diff --git a/src/main/java/hello/HelloWorld.java b/src/main/java/hello/HelloWorld.java
deleted file mode 100644
index 0f6004e..0000000
--- a/src/main/java/hello/HelloWorld.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package hello;
-
-public class HelloWorld {
- public static void main(String [] args) {
- Greeter greeter = new Greeter();
- System.out.println(greeter.sayHello());
- }
-}