Maven cleaup

This commit is contained in:
Gabriele C 2018-09-17 22:55:36 +02:00
parent 09c3e7bf22
commit 7f91b739f2
3 changed files with 95 additions and 69 deletions

152
pom.xml
View File

@ -11,8 +11,7 @@
<name>AuthMeReloaded</name> <name>AuthMeReloaded</name>
<description>The first authentication plugin for the Bukkit API!</description> <description>The first authentication plugin for the Bukkit API!</description>
<inceptionYear>2013</inceptionYear> <inceptionYear>2013</inceptionYear>
<url>http://dev.bukkit.org/bukkit-plugins/authme-reloaded/</url> <url>https://github.com/AuthMe/AuthMeReloaded</url>
<!-- See also: https://www.spigotmc.org/resources/authme-reloaded.6269/ -->
<organization> <organization>
<name>AuthMe-Team</name> <name>AuthMe-Team</name>
@ -55,31 +54,31 @@
</licenses> </licenses>
<properties> <properties>
<!-- Project properties --> <!-- Build cycle properties -->
<project.skipExtendedHashTests>false</project.skipExtendedHashTests>
<!-- Environment properties -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<jdk.version>1.8</jdk.version> <java.version>1.8</java.version>
<maven.minimumVersion>3.3.9</maven.minimumVersion>
<!-- Output properties --> <!-- Dependencies versions -->
<spigot.version>1.13.1-R0.1-SNAPSHOT</spigot.version>
<!-- Versioning properties -->
<project.outputName>AuthMe</project.outputName> <project.outputName>AuthMe</project.outputName>
<project.buildNumber>CUSTOM</project.buildNumber> <project.buildNumber>CUSTOM</project.buildNumber>
<project.skipExtendedHashTests>false</project.skipExtendedHashTests>
<project.versionCode>${project.version}-b${project.buildNumber}</project.versionCode> <project.versionCode>${project.version}-b${project.buildNumber}</project.versionCode>
<project.finalNameBase>${project.outputName}-${project.version}</project.finalNameBase>
<!-- BukkitPlugin properties --> <!-- Plugin description file properties -->
<bukkitplugin.name>${project.outputName}</bukkitplugin.name> <pluginDescription.name>${project.outputName}</pluginDescription.name>
<bukkitplugin.version>${project.versionCode}</bukkitplugin.version> <pluginDescription.version>${project.versionCode}</pluginDescription.version>
<bukkitplugin.main>${project.groupId}.${project.artifactId}.${bukkitplugin.name}</bukkitplugin.main> <pluginDescription.main>${project.groupId}.${project.artifactId}.${pluginDescription.name}</pluginDescription.main>
<bukkitplugin.authors>Xephi, sgdc3, DNx5, timvisee, games647, ljacqu, Gnat008</bukkitplugin.authors> <pluginDescription.authors>Xephi, sgdc3, DNx5, timvisee, games647, ljacqu, Gnat008</pluginDescription.authors>
<!-- Change Bukkit Version HERE! -->
<bukkit.version>1.13-R0.1-SNAPSHOT</bukkit.version>
</properties> </properties>
<prerequisites>
<maven>3.3.9</maven>
</prerequisites>
<!-- Jenkins profile --> <!-- Jenkins profile -->
<profiles> <profiles>
<!-- Set the buildNumber using the jenkins env. variable --> <!-- Set the buildNumber using the jenkins env. variable -->
@ -109,8 +108,9 @@
</profiles> </profiles>
<build> <build>
<defaultGoal>clean install</defaultGoal> <defaultGoal>clean package</defaultGoal>
<finalName>${project.outputName}-${project.version}-noshade</finalName> <!-- Little hack to make the shade plugin output a file with the right name -->
<finalName>${project.finalNameBase}-noshade</finalName>
<resources> <resources>
<resource> <resource>
@ -132,25 +132,51 @@
</resources> </resources>
<plugins> <plugins>
<!-- Enforce build environment -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>enforce-environment</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.3.9</version>
</requireMavenVersion>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<!-- Clean the target folder content -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId> <artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version> <version>3.1.0</version>
</plugin> </plugin>
<!-- Include resource files -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version> <version>3.1.0</version>
</plugin> </plugin>
<!-- Compile and include classes -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version> <version>3.8.0</version>
<configuration> <configuration>
<source>${jdk.version}</source> <source>${java.version}</source>
<target>${jdk.version}</target> <target>${java.version}</target>
</configuration> </configuration>
</plugin> </plugin>
<!-- Generate test coverage reports -->
<plugin> <plugin>
<groupId>org.jacoco</groupId> <groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId> <artifactId>jacoco-maven-plugin</artifactId>
@ -170,6 +196,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- Unit testing -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
@ -181,17 +208,24 @@
<systemPropertyVariables> <systemPropertyVariables>
<project.skipExtendedHashTests>${project.skipExtendedHashTests}</project.skipExtendedHashTests> <project.skipExtendedHashTests>${project.skipExtendedHashTests}</project.skipExtendedHashTests>
</systemPropertyVariables> </systemPropertyVariables>
<!-- Don't trim stack traces -->
<trimStackTrace>false</trimStackTrace>
</configuration> </configuration>
</plugin> </plugin>
<!-- Generate a jar containing classes and resources -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version> <version>3.1.0</version>
</plugin> </plugin>
<!-- Generate a jar containing the source javadoc -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version> <version>3.0.1</version>
<configuration>
<finalName>${project.finalNameBase}</finalName>
</configuration>
<executions> <executions>
<execution> <execution>
<id>attach-javadoc</id> <id>attach-javadoc</id>
@ -199,23 +233,16 @@
<goal>jar</goal> <goal>jar</goal>
</goals> </goals>
</execution> </execution>
<execution>
<id>aggregate-javadoc</id>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions> </executions>
<configuration>
<finalName>${project.outputName}-${project.version}</finalName>
<show>public</show>
<failOnError>false</failOnError>
</configuration>
</plugin> </plugin>
<!-- Generate a jar containing the java sources -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version> <version>3.0.1</version>
<configuration>
<finalName>${project.finalNameBase}</finalName>
</configuration>
<executions> <executions>
<execution> <execution>
<id>attach-sources</id> <id>attach-sources</id>
@ -224,10 +251,8 @@
</goals> </goals>
</execution> </execution>
</executions> </executions>
<configuration>
<finalName>${project.outputName}-${project.version}</finalName>
</configuration>
</plugin> </plugin>
<!-- Generate a jar containing classes, resources and shaded libraries -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
@ -241,9 +266,12 @@
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<!-- Don't create the reduced pom file, as we don't deploy the shaded jar -->
<createDependencyReducedPom>false</createDependencyReducedPom> <createDependencyReducedPom>false</createDependencyReducedPom>
<!-- Deploy the non shaded jar as main artifact -->
<shadedArtifactAttached>true</shadedArtifactAttached> <shadedArtifactAttached>true</shadedArtifactAttached>
<finalName>${project.outputName}-${project.version}</finalName> <!-- Use the base jar name, to help server owners download the right jar -->
<finalName>${project.finalNameBase}</finalName>
<!-- <!--
Relocate all lib we use in order to fix class loading errors if we use different versions Relocate all lib we use in order to fix class loading errors if we use different versions
@ -299,15 +327,15 @@
<pattern>at.favre.lib</pattern> <pattern>at.favre.lib</pattern>
<shadedPattern>fr.xephi.authme.libs.at.favre.lib</shadedPattern> <shadedPattern>fr.xephi.authme.libs.at.favre.lib</shadedPattern>
</relocation> </relocation>
<relocation>
<pattern>org.postgresql</pattern>
<shadedPattern>fr.xephi.authme.libs.org.postgresql</shadedPattern>
</relocation>
<!-- bStats metrics class --> <!-- bStats metrics class -->
<relocation> <relocation>
<pattern>org.bstats</pattern> <pattern>org.bstats</pattern>
<shadedPattern>fr.xephi.authme.libs.org.bstats</shadedPattern> <shadedPattern>fr.xephi.authme.libs.org.bstats</shadedPattern>
</relocation> </relocation>
<relocation>
<pattern>org.postgresql</pattern>
<shadedPattern>fr.xephi.authme.libs.org.postgresql</shadedPattern>
</relocation>
</relocations> </relocations>
<filters> <filters>
<!-- Ignore manifest signatures for shading the project into an uber-jar to fix --> <!-- Ignore manifest signatures for shading the project into an uber-jar to fix -->
@ -323,27 +351,31 @@
</filters> </filters>
</configuration> </configuration>
</plugin> </plugin>
<!-- Install the jars as artifacts into the local repository -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId> <artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version> <version>2.5.2</version>
</plugin> </plugin>
<!-- Deploy the jars as artifacts into the remote repository -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version> <version>2.8.2</version>
</plugin> </plugin>
<!-- Handle documentation generation, required by other plugins -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId> <artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version> <version>3.7.1</version>
</plugin> </plugin>
<!-- Publish coveralls test coverage reports, not included in the build cycle by default -->
<plugin> <plugin>
<groupId>org.eluder.coveralls</groupId> <groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId> <artifactId>coveralls-maven-plugin</artifactId>
<version>4.3.0</version> <version>4.3.0</version>
<configuration> <configuration>
<!-- The secret token is provided with a command-line parameter! --> <!-- The secret token is provided with a command-line parameter -->
<failOnServiceError>false</failOnServiceError> <failOnServiceError>false</failOnServiceError>
</configuration> </configuration>
</plugin> </plugin>
@ -357,10 +389,16 @@
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
</repository> </repository>
<!-- Essentials Repo --> <!-- CodeMC Repo (Contains many required libraries) -->
<repository> <repository>
<id>ess-repo</id> <id>codemc-repo</id>
<url>http://repo.ess3.net/content/groups/essentials</url> <url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
<!-- EssentialsX Repo -->
<repository>
<id>enderzone-repo</id>
<url>https://ci.ender.zone/plugin/repository/everything</url>
</repository> </repository>
<!-- ProtocolLib Repo --> <!-- ProtocolLib Repo -->
@ -381,12 +419,6 @@
<url>http://nexus.hc.to/content/repositories/pub_releases</url> <url>http://nexus.hc.to/content/repositories/pub_releases</url>
</repository> </repository>
<!-- Our Repo (Many libs) -->
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
<!-- bStats Repo --> <!-- bStats Repo -->
<repository> <repository>
<id>bstats-repo</id> <id>bstats-repo</id>
@ -511,7 +543,7 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>${bukkit.version}</version> <version>${spigot.version}</version>
<scope>provided</scope> <scope>provided</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
@ -766,22 +798,12 @@
</exclusions> </exclusions>
</dependency> </dependency>
<!-- Essentials plugin --> <!-- EssentialsX plugin -->
<dependency> <dependency>
<groupId>net.ess3</groupId> <groupId>net.ess3</groupId>
<artifactId>Essentials</artifactId> <artifactId>EssentialsX</artifactId>
<version>2.13.1</version> <version>2.15.0</version>
<scope>provided</scope> <scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<!-- BCrypt implementation --> <!-- BCrypt implementation -->

View File

@ -75,6 +75,8 @@ public class SQLite extends AbstractSqlDataSource {
/** /**
* Initializes the connection to the SQLite database. * Initializes the connection to the SQLite database.
*
* @throws SQLException when an SQL error occurs while connecting
*/ */
protected void connect() throws SQLException { protected void connect() throws SQLException {
try { try {
@ -90,6 +92,8 @@ public class SQLite extends AbstractSqlDataSource {
/** /**
* Creates the table if necessary, or adds any missing columns to the table. * Creates the table if necessary, or adds any missing columns to the table.
*
* @throws SQLException when an SQL error occurs while initializing the database
*/ */
@VisibleForTesting @VisibleForTesting
protected void setup() throws SQLException { protected void setup() throws SQLException {

View File

@ -1,9 +1,9 @@
name: ${bukkitplugin.name} name: ${pluginDescription.name}
authors: [${bukkitplugin.authors}] authors: [${pluginDescription.authors}]
website: ${project.url} website: ${project.url}
description: ${project.description} description: ${project.description}
main: ${bukkitplugin.main} main: ${pluginDescription.main}
version: ${bukkitplugin.version} version: ${pluginDescription.version}
api-version: 1.13 api-version: 1.13
softdepend: softdepend:
- Vault - Vault