From 8fe652e0f5651dc0ce09117d8da4c862b72aae0a Mon Sep 17 00:00:00 2001 From: "Reichenbach, Michael" <755327+Silthus@users.noreply.github.com> Date: Wed, 20 Nov 2024 07:18:02 +0100 Subject: [PATCH] fix: upgrade to full java 17 support BREAKING CHANGE: Java 17 is now mandatory --- build.gradle | 17 +++++++++++++++-- gradle.properties | 2 ++ .../net/silthus/template/TemplatePlugin.java | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index b710184..a4a9343 100644 --- a/build.gradle +++ b/build.gradle @@ -44,6 +44,10 @@ compileJava { options.compilerArgs += ["-parameters"] options.fork = true options.forkOptions.executable = 'javac' + options.compilerArgs += [ + '--release', '17', + '-Xlint:deprecation' + ] } archivesBaseName = project.property("pluginName") @@ -77,10 +81,15 @@ dependencies { implementation vaultAll() // Test dependencies - testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2' testImplementation 'org.mockito:mockito-core:4.11.0' testImplementation 'com.github.seeseemelk:MockBukkit-v1.19:2.144.3' testImplementation 'org.assertj:assertj-core:3.24.1' + + // Add these for test compilation + testImplementation project.shadow + testImplementation project.configurations.shadow } shadowJar { @@ -98,8 +107,12 @@ test { useJUnitPlatform() testLogging { events "skipped", "failed" + exceptionFormat = 'full' + showStandardStreams = true } - ignoreFailures = false + + // Add this to ensure test dependencies are available + systemProperty 'java.class.path', sourceSets.test.runtimeClasspath.asPath } processResources { diff --git a/gradle.properties b/gradle.properties index 2a73004..a6b1d20 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,3 +5,5 @@ author = Silthus mcVersion = 1.19.3 apiVersion = 1.13 version = 4.5.3 +sourceCompatibility=17 +targetCompatibility=17 \ No newline at end of file diff --git a/src/main/java/net/silthus/template/TemplatePlugin.java b/src/main/java/net/silthus/template/TemplatePlugin.java index bd95e70..12278bb 100644 --- a/src/main/java/net/silthus/template/TemplatePlugin.java +++ b/src/main/java/net/silthus/template/TemplatePlugin.java @@ -40,6 +40,7 @@ public TemplatePlugin() { instance = this; } + @SuppressWarnings("removal") public TemplatePlugin( JavaPluginLoader loader, PluginDescriptionFile description, File dataFolder, File file) { super(loader, description, dataFolder, file);