Hello world project with working maven build toolchain
authorJacob Casper <dev@jacobcasper.com>
Sun, 9 Jun 2024 01:01:34 +0000 (20:01 -0500)
committerJacob Casper <dev@jacobcasper.com>
Sun, 9 Jun 2024 01:01:34 +0000 (20:01 -0500)
.gitignore [new file with mode: 0644]
pom.xml [new file with mode: 0644]
src/main/java/com/jacobcasper/xivgraph/App.java [new file with mode: 0644]
src/main/java/com/jacobcasper/xivgraph/controllers/ApiController.java [new file with mode: 0644]
src/main/java/com/jacobcasper/xivgraph/controllers/StaticController.java [new file with mode: 0644]
src/main/resources/templates/index.html [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..d6c1194
--- /dev/null
@@ -0,0 +1,2 @@
+*.swp
+target/
diff --git a/pom.xml b/pom.xml
new file mode 100644 (file)
index 0000000..d8bfe52
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>com.jacobcasper</groupId>
+  <artifactId>xivgraph</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>xivgraph</name>
+  <url>https://www.jacobcasper.com</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <maven.compiler.source>22</maven.compiler.source>
+    <maven.compiler.target>22</maven.compiler.target>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot</artifactId>
+      <version>3.3.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-autoconfigure</artifactId>
+      <version>3.3.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-thymeleaf</artifactId>
+      <version>3.3.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-web</artifactId>
+      <version>3.3.0</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.11</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-clean-plugin</artifactId>
+        </plugin>
+        <plugin>
+          <artifactId>maven-resources-plugin</artifactId>
+        </plugin>
+        <plugin>
+          <artifactId>maven-compiler-plugin</artifactId>
+        </plugin>
+        <plugin>
+          <artifactId>maven-surefire-plugin</artifactId>
+        </plugin>
+        <plugin>
+          <artifactId>maven-assembly-plugin</artifactId>
+        </plugin>
+        <plugin>
+          <artifactId>maven-deploy-plugin</artifactId>
+        </plugin>
+        <plugin>
+          <groupId>org.springframework.boot</groupId>
+          <artifactId>spring-boot-maven-plugin</artifactId>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifest>
+              <addClasspath>true</addClasspath>
+              <mainClass>com.jacobcasper.xivgraph.App</mainClass>
+            </manifest>
+          </archive>
+          <descriptorRefs>
+            <descriptorRef>jar-with-dependencies</descriptorRef>
+          </descriptorRefs>
+        </configuration>
+        <executions>
+          <execution>
+            <id>make-assembly</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-install-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+            <execution>
+              <id>analyze</id>
+              <phase>package</phase>
+              <goals>
+                <goal>analyze-dep-mgt</goal>
+              </goals>
+              <configuration>
+                <failBuild>true</failBuild>
+              </configuration>
+            </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/main/java/com/jacobcasper/xivgraph/App.java b/src/main/java/com/jacobcasper/xivgraph/App.java
new file mode 100644 (file)
index 0000000..2a718ea
--- /dev/null
@@ -0,0 +1,11 @@
+package com.jacobcasper.xivgraph;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class App {
+    public static void main(String... args) {
+        SpringApplication.run(App.class, args);
+    }
+}
diff --git a/src/main/java/com/jacobcasper/xivgraph/controllers/ApiController.java b/src/main/java/com/jacobcasper/xivgraph/controllers/ApiController.java
new file mode 100644 (file)
index 0000000..22edac6
--- /dev/null
@@ -0,0 +1,16 @@
+package com.jacobcasper.xivgraph.controllers;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class ApiController {
+
+       @GetMapping("/api")
+       public Response root() {
+        return new Response();
+       }
+
+    record Response() {}
+}
diff --git a/src/main/java/com/jacobcasper/xivgraph/controllers/StaticController.java b/src/main/java/com/jacobcasper/xivgraph/controllers/StaticController.java
new file mode 100644 (file)
index 0000000..8d741aa
--- /dev/null
@@ -0,0 +1,20 @@
+package com.jacobcasper.xivgraph.controllers;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.view.RedirectView;
+
+@Controller
+public class StaticController {
+
+       @GetMapping("/")
+       public String root() {
+        return "index";
+       }
+    
+       @GetMapping("/index")
+       public String index() {
+        return "index";
+       }
+}
diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html
new file mode 100644 (file)
index 0000000..ed16574
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org">
+<head>
+    <title>XIV Raider Graph</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+</head>
+<body>
+    <p th:text="|Hello, World!|" />
+</body>
+</html>