Provide a jar with shaded guava!

Fix #505 #467
This commit is contained in:
Gabriele C 2016-02-09 21:31:17 +01:00
parent 07e5a67ad5
commit 0f13206a75
2 changed files with 79 additions and 34 deletions

View File

@ -8,8 +8,9 @@ test:
override: override:
- mvn clean install -B - mvn clean install -B
post: post:
- cp ./target/AuthMe*.jar $CIRCLE_ARTIFACTS - cp ./target/AuthMe-*-SNAPSHOT-spigot.jar $CIRCLE_ARTIFACTS
- cp ./target/AuthMe-*-SNAPSHOT.jar $CIRCLE_ARTIFACTS/AuthMe.jar - cp ./target/AuthMe-*-SNAPSHOT-legacy.jar $CIRCLE_ARTIFACTS
- cp ./target/AuthMe-*-SNAPSHOT-spigot.jar $CIRCLE_ARTIFACTS/AuthMe.jar
notify: notify:
webhooks: webhooks:
- url: https://webhooks.gitter.im/e/7b92ac1a1741748b26bf - url: https://webhooks.gitter.im/e/7b92ac1a1741748b26bf

108
pom.xml
View File

@ -52,6 +52,7 @@
<!-- Project Properties --> <!-- Project Properties -->
<pluginName>AuthMe</pluginName> <pluginName>AuthMe</pluginName>
<jarName>${pluginName}-${project.version}</jarName>
<mainClass>fr.xephi.authme.AuthMe</mainClass> <mainClass>fr.xephi.authme.AuthMe</mainClass>
<pluginAuthors>Xephi, sgdc3, DNx5, timvisee, games647, ljacqu</pluginAuthors> <pluginAuthors>Xephi, sgdc3, DNx5, timvisee, games647, ljacqu</pluginAuthors>
<buildNumber>Unknown</buildNumber> <buildNumber>Unknown</buildNumber>
@ -78,7 +79,7 @@
</profiles> </profiles>
<build> <build>
<finalName>AuthMe-${project.version}</finalName> <finalName>${jarName}-noshade</finalName>
<sourceDirectory>src/main/java</sourceDirectory> <sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory> <testSourceDirectory>src/test/java</testSourceDirectory>
@ -137,47 +138,77 @@
</configuration> </configuration>
</plugin> </plugin>
<!-- TODO: we need also to relocate the other libs -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version> <version>2.4.3</version>
<configuration> <configuration>
<createDependencyReducedPom>false</createDependencyReducedPom> <createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>false</minimizeJar> <minimizeJar>false</minimizeJar>
<relocations> <relocations>
<relocation> <relocation>
<pattern>org.mcstats</pattern> <pattern>org.mcstats</pattern>
<shadedPattern>fr.xephi.authme</shadedPattern> <shadedPattern>fr.xephi.authme</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>com.google.gson</pattern> <pattern>org.apache</pattern>
<shadedPattern>fr.xephi.authme.libs.gson</shadedPattern> <shadedPattern>fr.xephi.authme.libs.apache</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>com.zaxxer.hikari</pattern> <pattern>javax</pattern>
<shadedPattern>fr.xephi.authme.libs.hikari</shadedPattern> <shadedPattern>fr.xephi.authme.libs.javax</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.slf4j</pattern> <pattern>com.sun</pattern>
<shadedPattern>fr.xephi.authme.libs.slf4j</shadedPattern> <shadedPattern>fr.xephi.authme.libs.sun</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>com.maxmind.geoip</pattern> <pattern>com.google</pattern>
<shadedPattern>fr.xephi.authme.libs.geoip</shadedPattern> <shadedPattern>fr.xephi.authme.libs.google</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>net.ricecode.similarity</pattern> <pattern>com.zaxxer.hikari</pattern>
<shadedPattern>fr.xephi.authme.libs.similarity</shadedPattern> <shadedPattern>fr.xephi.authme.libs.hikari</shadedPattern>
</relocation> </relocation>
</relocations> <relocation>
</configuration> <pattern>org.slf4j</pattern>
<shadedPattern>fr.xephi.authme.libs.slf4j</shadedPattern>
</relocation>
<relocation>
<pattern>com.maxmind.geoip</pattern>
<shadedPattern>fr.xephi.authme.libs.geoip</shadedPattern>
</relocation>
<relocation>
<pattern>net.ricecode.similarity</pattern>
<shadedPattern>fr.xephi.authme.libs.similarity</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions> <executions>
<execution> <execution>
<id>spigot-shade</id>
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>shade</goal> <goal>shade</goal>
</goals> </goals>
<configuration>
<outputFile>target/${jarName}-spigot.jar</outputFile>
<artifactSet>
<excludes>
<exclude>com.google.guava:guava</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
<execution>
<id>legacy-shade</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<outputFile>target/${jarName}-legacy.jar</outputFile>
</configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
@ -325,6 +356,15 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- Guava (required to provide 1.7.10 and below compatibility) -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>17.0</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- Maxmind GeoIp API --> <!-- Maxmind GeoIp API -->
<dependency> <dependency>
<groupId>com.maxmind.geoip</groupId> <groupId>com.maxmind.geoip</groupId>
@ -373,6 +413,10 @@
<artifactId>persistence-api</artifactId> <artifactId>persistence-api</artifactId>
<groupId>javax.persistence</groupId> <groupId>javax.persistence</groupId>
</exclusion> </exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>