Add Release build config (bundle normal + standalone in one .jar file)

This commit is contained in:
GeorgH93 2019-06-01 18:49:03 +02:00
parent bc93ea7cb5
commit 46f54e63c3
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
3 changed files with 152 additions and 5 deletions

View File

@ -51,22 +51,33 @@ Minepacks is a backpack plugin for minecraft server running bukkit or spigot.
* [API][api] for developers
## Build from source:
The plugin can be build in 3 different configurations.
### Normal version:
```
git clone https://github.com/GeorgH93/Minepacks.git
cd Minepacks
mvn package
```
The final file will be in the `target` folder
The final file will be in the `target` folder, named `Minepacks-<CurrentVersion>.jar`.
### Standalone version:
This version works without the PCGF-PluginLib, however some API features are not available.
```
git clone https://github.com/GeorgH93/Minepacks.git
cd Minepacks
mvn package -P Standalone
mvn package -P Standalone,ExcludeBadRabbit
```
The final file will be in the `target/munged` folder
The final file will be in the `target` folder, named `Minepacks-<CurrentVersion>-Standalone.jar`.
### Release version:
This is the version of the plugin published on dev.bukkit.org and spigotmc.org.
```
git clone https://github.com/GeorgH93/Minepacks.git
cd Minepacks
mvn clean install -P Standalone
mvn clean package -P Release
```
The final file will be in the `target` folder, named `Minepacks-<CurrentVersion>-Release.jar`.
## API:
Minepacks V2 comes with an API that allows you to interact with this plugin.

96
pom.xml
View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>at.pcgamingfreaks</groupId>
<artifactId>Minepacks</artifactId>
<version>2.0-RC1</version>
<version>2.0-RC2</version>
<scm>
<connection>scm:git:git@github.com:GeorgH93/Minepacks.git</connection>
@ -80,6 +80,12 @@
<artifactId>PluginLib</artifactId>
<version>1.0.11-SNAPSHOT</version>
</dependency>
<!-- BadRabbit -->
<dependency>
<groupId>at.pcgamingfreaks</groupId>
<artifactId>BadRabbit</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
@ -137,6 +143,34 @@
</build>
<profiles>
<profile>
<id>ExcludeBadRabbit</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<excludes>
<exclude>at/pcgamingfreaks/Minepacks/Bukkit/MinepacksBadRabbit.class</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>Standalone</id>
<activation>
@ -148,7 +182,6 @@
<mainClass>${project.groupId}.${project.artifactId}Standalone.Bukkit.${project.artifactId}</mainClass>
</properties>
<build>
<finalName>${project.artifactId}Standalone-${project.version}</finalName>
<plugins>
<!-- Shades some required libs into the final jar -->
<plugin>
@ -162,8 +195,11 @@
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>Standalone</shadedClassifierName>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
<outputDirectory>${project.build.directory}</outputDirectory>
<artifactSet>
<includes>
<include>at.pcgamingfreaks:Minepacks-API</include>
@ -210,6 +246,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>munge-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>munge</id>
@ -226,6 +263,61 @@
</plugins>
</build>
</profile>
<profile>
<id>Release</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<version>${project.version}-Release</version>
<dependencies>softdepend: [ PCGF_PluginLib ]</dependencies>
<mainClass>${project.groupId}.${project.artifactId}.Bukkit.${project.artifactId}BadRabbit</mainClass>
</properties>
<dependencies>
<dependency>
<groupId>at.pcgamingfreaks</groupId>
<artifactId>Minepacks</artifactId>
<version>${project.version}</version>
<classifier>Standalone</classifier>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>Release</shadedClassifierName>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>false</minimizeJar>
<artifactSet>
<includes>
<include>at.pcgamingfreaks:Minepacks-API</include>
<include>at.pcgamingfreaks:BadRabbit</include>
<include>at.pcgamingfreaks:Minepacks</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>at.pcgamingfreaks.BadRabbit</pattern>
<shadedPattern>at.pcgamingfreaks.Minepacks</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<distributionManagement>

View File

@ -0,0 +1,44 @@
/*
* Copyright (C) 2019 GeorgH93
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package at.pcgamingfreaks.Minepacks.Bukkit;
import at.pcgamingfreaks.BadRabbit.Bukkit.BadRabbit;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
public class MinepacksBadRabbit extends BadRabbit
{
@Override
protected @NotNull JavaPlugin createInstance() throws Exception
{
JavaPlugin newPluginInstance;
if(Bukkit.getPluginManager().getPlugin("PCGF_PluginLib") == null)
{
getLogger().info("PCGF-PluginLib not installed. Switching to standalone mode!");
newPluginInstance = (JavaPlugin) Class.forName("at.pcgamingfreaks.MinepacksStandalone.Bukkit.Minepacks").newInstance();
}
else
{
getLogger().info("PCGF-PluginLib installed. Switching to normal mode!");
newPluginInstance = new Minepacks();
}
return newPluginInstance;
}
}