Adder gradle task and fixed config bug

This commit is contained in:
Elias Müller 2023-11-12 15:56:06 +01:00
parent 5d29c387a3
commit 5f6473b0fb
2 changed files with 12 additions and 3 deletions

View File

@ -72,4 +72,11 @@ tasks {
mergeServiceFiles()
archiveClassifier.set("")
}
}
}
tasks.register('copyJarToServer', Exec) {
dependsOn shadowJar
mustRunAfter shadowJar
commandLine 'scp', 'build/libs/Minigames-1.0-SNAPSHOT.jar', 'root@10.20.6.5:/root/minigames'
}

View File

@ -1,5 +1,6 @@
package eu.mhsl.minenet.minigames.util;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@ -18,14 +19,15 @@ public final class ResourceUtils {
final URI uri = Objects.requireNonNull(ResourceUtils.class.getResource("/" + source)).toURI();
FileSystem fileSystem = null;
// Only create a new filesystem if it's a jar file
// (People can run this from their IDE too)
if (uri.toString().startsWith("jar:"))
fileSystem = FileSystems.newFileSystem(uri, Map.of("create", "true"));
try {
//noinspection ResultOfMethodCallIgnored
new File("resources/").mkdirs();
final Path jarPath = Paths.get(uri);
final Path target = Path.of("resources/" + source);
if (Files.exists(target)) {
if(keepOutdated) return;
try (Stream<Path> pathStream = Files.walk(target)) {