Adder gradle task and fixed config bug
This commit is contained in:
parent
5d29c387a3
commit
5f6473b0fb
@ -73,3 +73,10 @@ tasks {
|
|||||||
archiveClassifier.set("")
|
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'
|
||||||
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package eu.mhsl.minenet.minigames.util;
|
package eu.mhsl.minenet.minigames.util;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
@ -18,14 +19,15 @@ public final class ResourceUtils {
|
|||||||
final URI uri = Objects.requireNonNull(ResourceUtils.class.getResource("/" + source)).toURI();
|
final URI uri = Objects.requireNonNull(ResourceUtils.class.getResource("/" + source)).toURI();
|
||||||
FileSystem fileSystem = null;
|
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:"))
|
if (uri.toString().startsWith("jar:"))
|
||||||
fileSystem = FileSystems.newFileSystem(uri, Map.of("create", "true"));
|
fileSystem = FileSystems.newFileSystem(uri, Map.of("create", "true"));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
//noinspection ResultOfMethodCallIgnored
|
||||||
|
new File("resources/").mkdirs();
|
||||||
final Path jarPath = Paths.get(uri);
|
final Path jarPath = Paths.get(uri);
|
||||||
final Path target = Path.of("resources/" + source);
|
final Path target = Path.of("resources/" + source);
|
||||||
|
|
||||||
if (Files.exists(target)) {
|
if (Files.exists(target)) {
|
||||||
if(keepOutdated) return;
|
if(keepOutdated) return;
|
||||||
try (Stream<Path> pathStream = Files.walk(target)) {
|
try (Stream<Path> pathStream = Files.walk(target)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user