updates POM to use build numbers in filename

This commit is contained in:
tastybento 2019-08-07 21:31:38 -07:00
parent 2beeb118f9
commit e5bdb80982
2 changed files with 89 additions and 19 deletions

91
pom.xml
View File

@ -5,11 +5,23 @@
<groupId>world.bentobox</groupId>
<artifactId>limits</artifactId>
<name>Limits</name>
<version>0.2.3-SNAPSHOT</version>
<version>${revision}</version>
<description>An add-on for BentoBox that limits blocks and entities on islands.</description>
<url>https://github.com/BentoBoxWorld/Limits</url>
<inceptionYear>2018</inceptionYear>
<developers>
<developer>
<id>tastybento</id>
<email>tastybento@bentobox.world</email>
<timezone>-8</timezone>
<roles>
<role>Lead Developer</role>
</roles>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/BentoBoxWorld/Limits.git</connection>
<developerConnection>scm:git:git@github.com:BentoBoxWorld/Limits.git</developerConnection>
@ -30,9 +42,61 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<powermock.version>1.7.4</powermock.version>
<!-- Non-minecraft related dependencies -->
<powermock.version>2.0.2</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.13.2-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.6.0-SNAPSHOT</bentobox.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>1.6.0</build.version>
</properties>
<!-- Profiles will allow to automatically change build version. -->
<profiles>
<profile>
<!-- ci profile is activated if exist environment variable BUILD_NUMBER. -->
<!-- It replaces ${build.number} that is currently '-LOCAL' with
correct build number from JENKINS machine. -->
<id>ci</id>
<activation>
<property>
<name>env.BUILD_NUMBER</name>
</property>
</activation>
<properties>
<!-- Override only if necessary -->
<build.number>-b${env.BUILD_NUMBER}</build.number>
</properties>
</profile>
<profile>
<!-- Master profile is activated if exist environment variable
GIT_BRANCH and its value is origin/master. -->
<!-- It will replace 'revision' with '${build.version}' so it
removes '-SNAPSHOT' string at the end. -->
<!-- Also, as this is release build, build number can be set
to empty string. -->
<!-- This profile will be used only if exist environment variable
GIT_BRANCH with value origin/master. -->
<id>master</id>
<activation>
<property>
<name>env.GIT_BRANCH</name>
<value>origin/master</value>
</property>
</activation>
<properties>
<!-- Override only if necessary -->
<revision>${build.version}</revision>
<!-- Empties build number variable. -->
<build.number></build.number>
</properties>
</profile>
</profiles>
<repositories>
<repository>
<id>my-local-repo</id>
@ -53,16 +117,18 @@
</repositories>
<dependencies>
<!-- Spigot API -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<version>${spigot.version}</version>
<scope>provided</scope>
</dependency>
<!-- Mockito (Unit testing) -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<artifactId>mockito-core</artifactId>
<version>3.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
@ -73,16 +139,17 @@
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<artifactId>powermock-api-mockito2</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId>
<version>1.6.0-SNAPSHOT</version>
<version>${bentobox.version}</version>
<scope>provided</scope>
</dependency>
<!-- For EpicSpawners -->
<dependency>
<groupId>com.songoda</groupId>
<artifactId>EpicSpawners-API</artifactId>
@ -92,6 +159,16 @@
</dependencies>
<build>
<!-- By default ${revision} is ${build.version}-SNAPSHOT -->
<!-- If GIT_BRANCH variable is set to origin/master, then it will
be only ${build.version}. -->
<!-- By default ${build.number} is -LOCAL. -->
<!-- If the BUILD_NUMBER variable is set, then it will be -b[number]. -->
<!-- If GIT_BRANCH variable is set to origin/master, then it will
be the empty string. -->
<finalName>${project.name}-${revision}${build.number}</finalName>
<defaultGoal>clean package</defaultGoal>
<resources>
<resource>

View File

@ -67,6 +67,8 @@ public class JoinListenerTest {
private IslandBlockCount ibc;
@Mock
private OfflinePlayer owner;
@Mock
private Island island;
/**
* @throws java.lang.Exception
@ -80,7 +82,6 @@ public class JoinListenerTest {
when(addon.getGameModePermPrefix(any())).thenReturn("bskyblock.");
// Island Manager
when(im.hasIsland(any(), any(UUID.class))).thenReturn(true);
Island island = mock(Island.class);
when(island.getUniqueId()).thenReturn("unique_id");
when(im.getIsland(any(), any(UUID.class))).thenReturn(island);
// Default is that player has island
@ -105,6 +106,9 @@ public class JoinListenerTest {
when(owner.isOnline()).thenReturn(true);
when(owner.getPlayer()).thenReturn(player);
when(Bukkit.getOfflinePlayer(any(UUID.class))).thenReturn(owner);
// Island
when(island.getOwner()).thenReturn(UUID.randomUUID());
}
/**
@ -119,7 +123,6 @@ public class JoinListenerTest {
*/
@Test
public void testOnNewIslandWrongReason() {
Island island = mock(Island.class);
IslandEvent e = new IslandEvent(island, null, false, null, IslandEvent.Reason.BAN);
jl.onNewIsland(e);
verify(island, never()).getWorld();
@ -130,7 +133,6 @@ public class JoinListenerTest {
*/
@Test
public void testOnNewIslandRegistered() {
Island island = mock(Island.class);
IslandEvent e = new IslandEvent(island, null, false, null, IslandEvent.Reason.REGISTERED);
jl.onNewIsland(e);
verify(island).getWorld();
@ -141,7 +143,6 @@ public class JoinListenerTest {
*/
@Test
public void testOnNewIslandResetted() {
Island island = mock(Island.class);
IslandEvent e = new IslandEvent(island, null, false, null, IslandEvent.Reason.RESETTED);
jl.onNewIsland(e);
verify(island).getWorld();
@ -153,7 +154,6 @@ public class JoinListenerTest {
@Test
public void testOnNewIslandCreated() {
when(addon.inGameModeWorld(any())).thenReturn(true);
Island island = mock(Island.class);
IslandEvent e = new IslandEvent(island, null, false, null, IslandEvent.Reason.CREATED);
jl.onNewIsland(e);
verify(island).getWorld();
@ -167,7 +167,6 @@ public class JoinListenerTest {
public void testOnNewIslandCreatedOffline() {
when(owner.isOnline()).thenReturn(false);
when(addon.inGameModeWorld(any())).thenReturn(true);
Island island = mock(Island.class);
IslandEvent e = new IslandEvent(island, null, false, null, IslandEvent.Reason.CREATED);
jl.onNewIsland(e);
verify(island).getWorld();
@ -182,7 +181,6 @@ public class JoinListenerTest {
when(addon.getGameModeName(any())).thenReturn("");
when(addon.getGameModePermPrefix(any())).thenReturn("bskyblock.");
when(addon.inGameModeWorld(any())).thenReturn(true);
Island island = mock(Island.class);
IslandEvent e = new IslandEvent(island, null, false, null, IslandEvent.Reason.CREATED);
jl.onNewIsland(e);
when(addon.getGameModeName(any())).thenReturn("bskyblock");
@ -196,7 +194,6 @@ public class JoinListenerTest {
*/
@Test
public void testOnOwnerChange() {
Island island = mock(Island.class);
TeamSetownerEvent e = mock(TeamSetownerEvent.class);
when(e.getIsland()).thenReturn(island);
when(e.getNewOwner()).thenReturn(UUID.randomUUID());
@ -379,7 +376,6 @@ public class JoinListenerTest {
*/
@Test
public void testOnUnregisterIslandNotUnregistered() {
Island island = mock(Island.class);
IslandEvent e = new IslandEvent(island, null, false, null, IslandEvent.Reason.BAN);
jl.onUnregisterIsland(e);
verify(island, never()).getWorld();
@ -390,7 +386,6 @@ public class JoinListenerTest {
*/
@Test
public void testOnUnregisterIslandNotInWorld() {
Island island = mock(Island.class);
IslandEvent e = new IslandEvent(island, null, false, null, IslandEvent.Reason.UNREGISTERED);
jl.onUnregisterIsland(e);
verify(island).getWorld();
@ -406,7 +401,6 @@ public class JoinListenerTest {
Map<Material, Integer> map = mock(Map.class);
when(ibc.getBlockLimits()).thenReturn(map);
when(addon.inGameModeWorld(any())).thenReturn(true);
Island island = mock(Island.class);
IslandEvent e = new IslandEvent(island, null, false, null, IslandEvent.Reason.UNREGISTERED);
jl.onUnregisterIsland(e);
verify(island).getWorld();
@ -425,7 +419,6 @@ public class JoinListenerTest {
Map<Material, Integer> map = mock(Map.class);
when(ibc.getBlockLimits()).thenReturn(map);
when(addon.inGameModeWorld(any())).thenReturn(true);
Island island = mock(Island.class);
IslandEvent e = new IslandEvent(island, null, false, null, IslandEvent.Reason.UNREGISTERED);
jl.onUnregisterIsland(e);
verify(island).getWorld();