From e94adb04eabdc0988f8b44397888107d52cf348b Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 8 Mar 2017 16:51:01 +1100 Subject: [PATCH] Add maven repo closes #1394 --- .gitignore | 1 + Core/build.gradle | 45 ++++++++++++++++++- .../plot/commands/Load.java | 2 +- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7fd3f39dd..e00d4f9de 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ Core/build Bukkit/build ### Maven ### +/mvn /target/lib /target/maven-archiver /target/classes diff --git a/Core/build.gradle b/Core/build.gradle index d5203cb39..81293377c 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -7,5 +7,46 @@ dependencies { sourceCompatibility = 1.7 targetCompatibility = 1.7 -jar.archiveName = rootProject.name + "-Core-${parent.version}.jar" -jar.destinationDir = file '../target' \ No newline at end of file + +processResources { + from('src/main/resources') { + include 'plotsquared.properties' + expand( + version: "${project.parent.version}", + name: project.parent.name, + ) + } +} + +jar.archiveName="plotsquared-api-${project.parent.version}.jar" +jar.destinationDir = file '../mvn/com/plotsquared/plotsquared-api/' + project.parent.version +task createPom << { + pom { + project { + groupId 'com.plotsquared' + artifactId 'plotsquared-api' + version project.parent.version + } + }.writeTo("../mvn/com/plotsquared/plotsquared-api/${project.parent.version}/plotsquared-api-${project.parent.version}.pom") + pom { + project { + groupId 'com.plotsquared' + artifactId 'plotsquared-api' + version 'latest' + } + }.writeTo("../mvn/com/plotsquared/plotsquared-api/latest/plotsquared-api-latest.pom") +} + +task copyFiles { + doLast { + copy { + from "../mvn/com/plotsquared/plotsquared-api/${project.parent.version}/" + into '../mvn/com/plotsquared/plotsquared-api/latest/' + include('*.jar') + rename ("plotsquared-api-${project.parent.version}.jar", 'plotsquared-api-latest.jar') + } + } +} + +build.finalizedBy(copyFiles) +copyFiles.dependsOn(createPom) \ No newline at end of file diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java index 508409bb5..3e714b784 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java @@ -141,7 +141,7 @@ public class Load extends SubCommand { try { String schematic = schematics.get(i); String[] split = schematic.split("_"); - if (split.length != 6) { + if (split.length < 5) { continue; } String time = secToTime((System.currentTimeMillis() / 1000) - Long.parseLong(split[0]));