From 7ab595f4aef89e1752f19c0a136ab1b346ee1ab5 Mon Sep 17 00:00:00 2001 From: kennedy-dev Date: Tue, 16 Sep 2025 21:06:32 -0400 Subject: [PATCH 01/11] Fix Gradle 9.0 compatibility and JUnit 5 configuration - Replace deprecated applicationName with application.mainClass - Move sourceCompatibility to java configuration block - Upgrade from Java 8 to Java 17 (required by Gradle 9.0) - Add useJUnitPlatform() for JUnit 5 test discovery - Add junit-platform-launcher dependency for test execution - Resolve 'Failed to load JUnit Platform' runtime error All tests now compile and execute successfully. --- build.gradle | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 9c53499e..b1431443 100644 --- a/build.gradle +++ b/build.gradle @@ -6,10 +6,18 @@ plugins { group 'to-do.list' version '1.0-SNAPSHOT' -applicationName = "todo" -mainClassName = 'App' +application { + mainClass = 'App' +} -sourceCompatibility = 1.8 +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +test { + useJUnitPlatform() +} repositories { mavenCentral() @@ -18,6 +26,7 @@ repositories { dependencies { testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.7.0' implementation "com.sparkjava:spark-core:2.6.0" implementation "com.sparkjava:spark-template-handlebars:2.5.5" implementation 'org.slf4j:slf4j-simple:1.7.21' @@ -25,5 +34,4 @@ dependencies { implementation group: 'com.h2database', name: 'h2', version: '1.4.191' } - -task stage(dependsOn: ['clean', 'installDist']) +task stage(dependsOn: ['clean', 'installDist']) \ No newline at end of file From bfdf9488407af9705733a910106267d5345eae31 Mon Sep 17 00:00:00 2001 From: kennedy-dev Date: Tue, 16 Sep 2025 23:08:28 -0400 Subject: [PATCH 02/11] fixed gradle distro to 9.0 --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bb8b2fc2..b5c7b295 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From a08734a9b8c6b81b79644698745217674b9f51cf Mon Sep 17 00:00:00 2001 From: kennedy-dev Date: Tue, 16 Sep 2025 23:11:56 -0400 Subject: [PATCH 03/11] fixed gradle distro to 9.0 --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b5c7b295..d30212c0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 1f18e4425e6ef702a3fc8b3094fba4a20843b05f Mon Sep 17 00:00:00 2001 From: kennedy-dev Date: Tue, 16 Sep 2025 23:58:44 -0400 Subject: [PATCH 04/11] changed author in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 282bb1e5..9be1abc4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Java-Week3-ToDo-List -Author: Brian Marete +Author: Kennedy Mukuna Official repo for the "To Do List" project using Java, Spark, Handlebars etc for week 3 of java unit. From 2ea15415d5b7254490300c1ba3d0f95eb6b74b47 Mon Sep 17 00:00:00 2001 From: kennedy-dev Date: Wed, 17 Sep 2025 00:11:22 -0400 Subject: [PATCH 05/11] NA --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9be1abc4..7416b103 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Java-Week3-ToDo-List -Author: Kennedy Mukuna +Author: Kennedy Mukuna. Official repo for the "To Do List" project using Java, Spark, Handlebars etc for week 3 of java unit. From fb9b4e4b508d81fa51f0ae204991b21ca9cb09dc Mon Sep 17 00:00:00 2001 From: kennedy-dev Date: Wed, 17 Sep 2025 00:16:22 -0400 Subject: [PATCH 06/11] fixed ProcFile --- Procfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Procfile b/Procfile index 8f1d0e3b..99508150 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: ./build/install/todo/bin/todo +web: java -Dserver.port=$PORT -jar build/libs/*.jar \ No newline at end of file From 11ccbd299ff57c30d8ec146ef5403492f3735935 Mon Sep 17 00:00:00 2001 From: kennedy-dev Date: Wed, 17 Sep 2025 00:21:32 -0400 Subject: [PATCH 07/11] Added jar manifest to build.gradle --- build.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.gradle b/build.gradle index b1431443..2288d1db 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,12 @@ application { mainClass = 'App' } +jar { + manifest { + attributes 'Main-Class': 'App' + } +} + java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 From f56b002c76bb32b036f73bd4384fb98f7ed2f24d Mon Sep 17 00:00:00 2001 From: kennedy-dev Date: Wed, 17 Sep 2025 00:25:20 -0400 Subject: [PATCH 08/11] fixed ProcFile --- build.gradle | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 2288d1db..660ba641 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id 'java' id 'application' + id 'com.github.johnrengelman.shadow' version '7.1.2' } group 'to-do.list' @@ -10,10 +11,10 @@ application { mainClass = 'App' } -jar { - manifest { - attributes 'Main-Class': 'App' - } +shadowJar { + archiveBaseName.set('java-todo') + archiveClassifier.set('') + archiveVersion.set('') } java { From f2444705d507fe29ae2b378793da43626b9f0d8b Mon Sep 17 00:00:00 2001 From: kennedy-dev Date: Wed, 17 Sep 2025 00:27:12 -0400 Subject: [PATCH 09/11] fixed ProcFile --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 660ba641..3452818c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' id 'application' - id 'com.github.johnrengelman.shadow' version '7.1.2' + id 'com.github.johnrengelman.shadow' version '8.1.1' } group 'to-do.list' From 6fce9846f999c64a390d0a2a303cfd2c4eb96832 Mon Sep 17 00:00:00 2001 From: kennedy-dev Date: Wed, 17 Sep 2025 00:29:47 -0400 Subject: [PATCH 10/11] fixed ProcFile --- build.gradle | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 3452818c..3a2d4e0c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,6 @@ plugins { id 'java' id 'application' - id 'com.github.johnrengelman.shadow' version '8.1.1' } group 'to-do.list' @@ -11,10 +10,14 @@ application { mainClass = 'App' } -shadowJar { - archiveBaseName.set('java-todo') - archiveClassifier.set('') - archiveVersion.set('') +jar { + manifest { + attributes 'Main-Class': 'App' + } + from { + configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } + } + duplicatesStrategy = DuplicatesStrategy.EXCLUDE } java { From 0e53a1d503ae68a6969517c7afa4f68fec433c06 Mon Sep 17 00:00:00 2001 From: kennedy-dev Date: Wed, 17 Sep 2025 00:37:56 -0400 Subject: [PATCH 11/11] fixed ProcFile --- Jenkinsfile | 2 +- Procfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1c8f388b..47d789fb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ pipeline { agent any tools { - gradle 'Gradle-6' + gradle 'Gradle-9' } diff --git a/Procfile b/Procfile index 99508150..1e882d73 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: java -Dserver.port=$PORT -jar build/libs/*.jar \ No newline at end of file +web: java -Dserver.port=$PORT --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED -jar build/libs/*.jar \ No newline at end of file