Use another method to add build number to plugin version

This commit is contained in:
filoghost 2020-08-22 17:46:31 +02:00
parent 99aba32af5
commit af402447b6
3 changed files with 220 additions and 238 deletions

View File

@ -72,27 +72,35 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<!-- Appends build number to plugin version on SNAPSHOT builds. -->
<execution>
<id>set-plugin-version</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
<goal>bsh-property</goal>
</goals>
<configuration>
<exportAntProperties>true</exportAntProperties>
<target>
<property environment="env" />
<condition property="project.pluginVersion" value="${project.version}-b${env.BUILD_NUMBER}" else="${project.version}">
<and>
<isset property="env.BUILD_NUMBER" />
<contains string="${project.version}" substring="SNAPSHOT" />
</and>
</condition>
</target>
<properties>
<property>pluginVersion</property>
</properties>
<source>
projectVersion = project.version;
buildNumber = System.getenv("BUILD_NUMBER");
String pluginVersion;
if (buildNumber != null @and projectVersion.contains("SNAPSHOT")) {
pluginVersion = projectVersion + "-b" + buildNumber;
} else {
pluginVersion = projectVersion;
}
print("Project version: " + projectVersion);
print("Build number: " + buildNumber);
print("Computed plugin version: " + pluginVersion);
</source>
</configuration>
</execution>
</executions>
@ -107,7 +115,7 @@
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Implementation-Version>${project.pluginVersion}</Implementation-Version>
<Implementation-Version>${pluginVersion}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>

View File

@ -1,6 +1,6 @@
name: ChestCommands
main: me.filoghost.chestcommands.ChestCommands
version: ${project.pluginVersion}
version: ${pluginVersion}
api-version: 1.13
softdepend: [Vault, BarAPI, PlaceholderAPI]

420
pom.xml
View File

@ -1,223 +1,197 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.filoghost.chestcommands</groupId>
<artifactId>chestcommands-parent</artifactId>
<name>ChestCommands Parent</name>
<version>4.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<url>https://dev.bukkit.org/projects/chest-commands</url>
<licenses>
<license>
<name>GNU General Public License, Version 3</name>
<url>https://www.gnu.org/licenses/gpl-3.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>https://github.com/filoghost/ChestCommands</url>
<connection>scm:git:git://github.com:filoghost/ChestCommands.git</connection>
<developerConnection>scm:git:git@github.com:filoghost/ChestCommands.git</developerConnection>
</scm>
<distributionManagement>
<snapshotRepository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>codemc-releases</id>
<url>https://repo.codemc.io/repository/maven-releases/</url>
</repository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.test.skip>true</maven.test.skip>
</properties>
<modules>
<module>api</module>
<module>plugin</module>
</modules>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>vault-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
</repository>
<repository>
<id>confuser-repo</id>
<url>https://ci.frostcast.net/plugin/repository/everything/</url>
</repository>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.io/repository/maven-public/</url>
</repository>
<repository>
<id>placeholderapi-repo</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.confuser</groupId>
<artifactId>BarAPI</artifactId>
<version>3.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.9.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit-lite</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>me.filoghost.updatechecker</groupId>
<artifactId>updatechecker</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>me.filoghost.fcommons</groupId>
<artifactId>fcommons</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>chestcommands-api</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<defaultGoal>clean package</defaultGoal>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifest>
<addClasspath>false</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<versionRange>[0.0,)</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<reactorModuleConvergence />
<requireMavenVersion>
<version>[3.6.0,)</version>
</requireMavenVersion>
<requireJavaVersion>
<version>[1.8,)</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.filoghost.chestcommands</groupId>
<artifactId>chestcommands-parent</artifactId>
<name>ChestCommands Parent</name>
<version>4.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<url>https://dev.bukkit.org/projects/chest-commands</url>
<licenses>
<license>
<name>GNU General Public License, Version 3</name>
<url>https://www.gnu.org/licenses/gpl-3.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>https://github.com/filoghost/ChestCommands</url>
<connection>scm:git:git://github.com:filoghost/ChestCommands.git</connection>
<developerConnection>scm:git:git@github.com:filoghost/ChestCommands.git</developerConnection>
</scm>
<distributionManagement>
<snapshotRepository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>codemc-releases</id>
<url>https://repo.codemc.io/repository/maven-releases/</url>
</repository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.test.skip>true</maven.test.skip>
</properties>
<modules>
<module>api</module>
<module>plugin</module>
</modules>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>vault-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
</repository>
<repository>
<id>confuser-repo</id>
<url>https://ci.frostcast.net/plugin/repository/everything/</url>
</repository>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.io/repository/maven-public/</url>
</repository>
<repository>
<id>placeholderapi-repo</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.confuser</groupId>
<artifactId>BarAPI</artifactId>
<version>3.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.9.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit-lite</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>me.filoghost.updatechecker</groupId>
<artifactId>updatechecker</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>me.filoghost.fcommons</groupId>
<artifactId>fcommons</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>chestcommands-api</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<defaultGoal>clean package</defaultGoal>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifest>
<addClasspath>false</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<reactorModuleConvergence />
<requireMavenVersion>
<version>[3.6.0,)</version>
</requireMavenVersion>
<requireJavaVersion>
<version>[1.8,)</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>