Dynamic Version Changing

Version now gets pulled directly from the pom and inserted into plugin.yml
Should prevent any wrong version numbers getting published!
This commit is contained in:
jameslfc19 2020-04-27 13:14:34 +01:00
parent 47a14aed0f
commit 6fca1a2a72
3 changed files with 25 additions and 5 deletions

21
pom.xml
View File

@ -6,9 +6,7 @@
<groupId>com.jamesdpeters.chests</groupId>
<artifactId>ChestsPlusPlus</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.15 v1.3</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
@ -125,12 +123,27 @@
<!--Tell the shade plugin which of it's goals to attempt to run during this phase-->
<configuration>
<!--Tell the shade plugin where to put our jar file-->
<outputFile>${project.basedir}/Server/plugins/${project.artifactId}.jar</outputFile>
<outputFile>${project.basedir}/Server/plugins/${project.artifactId}-${version}.jar</outputFile>
<!-- <minimizeJar>true</minimizeJar>-->
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<id>filter-src</id>
<goals>
<goal>filter-sources</goal><!-- add this if you filter main sources -->
<goal>filter-test-sources</goal><!-- add this if you filter test sources -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
<!--Tell maven to enable resource filtering so we can use macros like '${project.version}' inside of our plugin.yml-->

View File

@ -0,0 +1,6 @@
package com.jamesdpeters.minecraft.chests.maventemplates;
public class BuildConstants {
public static final String VERSION = "${version}";
}

View File

@ -11,6 +11,7 @@ import com.jamesdpeters.minecraft.chests.misc.Stats;
import com.jamesdpeters.minecraft.chests.serialize.InventoryStorage;
import com.jamesdpeters.minecraft.chests.serialize.LinkedChest;
import com.jamesdpeters.minecraft.chests.versionchecker.UpdateCheck;
import com.jamesdpeters.minecraft.chests.maventemplates.BuildConstants;
import fr.minuskube.inv.InventoryManager;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
@ -27,7 +28,7 @@ import org.bukkit.plugin.java.annotation.plugin.Plugin;
import org.bukkit.plugin.java.annotation.plugin.author.Author;
@Plugin(name = "ChestsPlusPlus", version = "1.15 v1.3")
@Plugin(name = "ChestsPlusPlus", version = BuildConstants.VERSION)
@ApiVersion(ApiVersion.Target.v1_13)
@Description(value = "Minecraft Spigot mod that enhances chests and hoppers, with ChestLinks and Hopper filters!")
@Author(value = "jameslfc19")