Added SonarCloud

This commit is contained in:
tastybento 2019-11-03 16:18:50 -08:00
parent bc193dbc6b
commit 614eec5c26
3 changed files with 288 additions and 209 deletions

1
.gitignore vendored
View File

@ -25,3 +25,4 @@ hs_err_pid*
/.DS_Store /.DS_Store
/.classpath /.classpath
/.project /.project
/.settings/

23
.travis.yml Normal file
View File

@ -0,0 +1,23 @@
language: java
sudo: false
addons:
sonarcloud:
organization: "bentobox-world"
token:
secure: $SONAR_TOKEN
jdk:
- openjdk8
- openjdk11
matrix:
allow_failures:
- jdk: openjdk11
script:
# the following command line builds the project, runs the tests with coverage and then execute the SonarCloud analysis
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.projectKey=BentoBoxWorld_CaveBlock
cache:
directories:
- '$HOME/.m2/repository'
- '$HOME/.sonar/cache'

473
pom.xml
View File

@ -1,224 +1,279 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> 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> <modelVersion>4.0.0</modelVersion>
<groupId>world.bentobox</groupId> <groupId>world.bentobox</groupId>
<artifactId>caveblock</artifactId> <artifactId>caveblock</artifactId>
<version>${revision}</version> <version>${revision}</version>
<name>CaveBlock</name> <name>CaveBlock</name>
<description>CaveBlock is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland.</description> <description>CaveBlock is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland.</description>
<url>https://github.com/BentoBoxWorld/CaveBlock</url> <url>https://github.com/BentoBoxWorld/CaveBlock</url>
<inceptionYear>2019</inceptionYear> <inceptionYear>2019</inceptionYear>
<scm> <scm>
<connection>scm:git:https://github.com/BentoBoxWorld/CaveBlock.git</connection> <connection>scm:git:https://github.com/BentoBoxWorld/CaveBlock.git</connection>
<developerConnection>scm:git:git@github.com:BentoBoxWorld/CaveBlock.git</developerConnection> <developerConnection>scm:git:git@github.com:BentoBoxWorld/CaveBlock.git</developerConnection>
<url>https://github.com/BentoBoxWorld/CaveBlock</url> <url>https://github.com/BentoBoxWorld/CaveBlock</url>
</scm> </scm>
<ciManagement> <ciManagement>
<system>jenkins</system> <system>jenkins</system>
<url>http://ci.codemc.org/job/BentoBoxWorld/job/CaveBlock</url> <url>http://ci.codemc.org/job/BentoBoxWorld/job/CaveBlock</url>
</ciManagement> </ciManagement>
<issueManagement> <issueManagement>
<system>GitHub</system> <system>GitHub</system>
<url>https://github.com/BentoBoxWorld/CaveBlock/issues</url> <url>https://github.com/BentoBoxWorld/CaveBlock/issues</url>
</issueManagement> </issueManagement>
<distributionManagement> <distributionManagement>
<snapshotRepository> <snapshotRepository>
<id>codemc-snapshots</id> <id>codemc-snapshots</id>
<url>https://repo.codemc.org/repository/maven-snapshots</url> <url>https://repo.codemc.org/repository/maven-snapshots</url>
</snapshotRepository> </snapshotRepository>
<repository> <repository>
<id>codemc-releases</id> <id>codemc-releases</id>
<url>https://repo.codemc.org/repository/maven-releases</url> <url>https://repo.codemc.org/repository/maven-releases</url>
</repository> </repository>
</distributionManagement> </distributionManagement>
<properties> <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>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<!-- More visible way how to change dependency versions --> <!-- More visible way how to change dependency versions -->
<spigot.version>1.14.4-R0.1-SNAPSHOT</spigot.version> <spigot.version>1.14.4-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.8.0</bentobox.version> <bentobox.version>1.8.0</bentobox.version>
<!-- Revision variable removes warning about dynamic version --> <!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision> <revision>${build.version}-SNAPSHOT</revision>
<!-- This allows to change between versions and snapshots. --> <!-- This allows to change between versions and snapshots. -->
<build.version>1.8.0</build.version> <build.version>1.8.0</build.version>
<build.number>-LOCAL</build.number> <build.number>-LOCAL</build.number>
</properties> </properties>
<profiles> <profiles>
<!-- Build profile is activated by BUILD_NUMBER variable. It replaces 0 with correct build number. --> <!-- Build profile is activated by BUILD_NUMBER variable. It replaces
<!-- This profile will be used only if BUILD_NUMBER environment variable exists. --> 0 with correct build number. -->
<profile> <!-- This profile will be used only if BUILD_NUMBER environment variable
<id>ci</id> exists. -->
<activation> <profile>
<property> <id>ci</id>
<name>env.BUILD_NUMBER</name> <activation>
</property> <property>
</activation> <name>env.BUILD_NUMBER</name>
<properties> </property>
<!-- Override only if necessary --> </activation>
<build.number>-b${env.BUILD_NUMBER}</build.number> <properties>
<!-- GIT_BRANCH --> <!-- Override only if necessary -->
</properties> <build.number>-b${env.BUILD_NUMBER}</build.number>
</profile> <!-- GIT_BRANCH -->
<!-- master profile is activated by GIT_BRANCH variable. It removes '-SNAPSHOT' at the end of --> </properties>
<!-- ${build.version} --> </profile>
<!-- This profile will be used only if environment variable GIT_BRANCH is origin/master. --> <!-- master profile is activated by GIT_BRANCH variable. It removes
<profile> '-SNAPSHOT' at the end of -->
<id>master</id> <!-- ${build.version} -->
<activation> <!-- This profile will be used only if environment variable GIT_BRANCH
<property> is origin/master. -->
<name>env.GIT_BRANCH</name> <profile>
<value>origin/master</value> <id>master</id>
</property> <activation>
</activation> <property>
<properties> <name>env.GIT_BRANCH</name>
<!-- Override only if necessary --> <value>origin/master</value>
<revision>${build.version}</revision> </property>
<build.number></build.number> </activation>
<!-- GIT_BRANCH --> <properties>
</properties> <!-- Override only if necessary -->
</profile> <revision>${build.version}</revision>
</profiles> <build.number></build.number>
<!-- GIT_BRANCH -->
</properties>
</profile>
<profile>
<id>sonar</id>
<properties>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>bentobox-world</sonar.organization>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sonar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<repositories> <repositories>
<repository> <repository>
<id>spigot-repo</id> <id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
</repository> </repository>
<repository> <repository>
<id>codemc-repo</id> <id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public</url> <url>https://repo.codemc.org/repository/maven-public</url>
</repository> </repository>
</repositories> </repositories>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>${spigot.version}</version> <version>${spigot.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>world.bentobox</groupId> <groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId> <artifactId>bentobox</artifactId>
<version>${bentobox.version}</version> <version>${bentobox.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>${project.name}-${revision}${build.number}</finalName> <finalName>${project.name}-${revision}${build.number}</finalName>
<defaultGoal>clean package</defaultGoal> <defaultGoal>clean package</defaultGoal>
<resources> <resources>
<resource> <resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
<filtering>true</filtering> <filtering>true</filtering>
</resource> </resource>
<resource> <resource>
<directory>src/main/resources/locales</directory> <directory>src/main/resources/locales</directory>
<targetPath>./locales</targetPath> <targetPath>./locales</targetPath>
<filtering>false</filtering> <filtering>false</filtering>
<includes> <includes>
<include>*.yml</include> <include>*.yml</include>
</includes> </includes>
</resource> </resource>
<resource> <resource>
<directory>src/main/resources/blueprints</directory> <directory>src/main/resources/blueprints</directory>
<targetPath>./blueprints</targetPath> <targetPath>./blueprints</targetPath>
<filtering>true</filtering> <filtering>true</filtering>
<includes> <includes>
<include>*.json</include> <include>*.json</include>
<include>*.blu</include> <include>*.blu</include>
</includes> </includes>
</resource> </resource>
</resources> </resources>
<plugins> <plugins>
<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>
<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>
<configuration> <configuration>
<nonFilteredFileExtensions> <nonFilteredFileExtensions>
<nonFilteredFileExtension>blu</nonFilteredFileExtension> <nonFilteredFileExtension>blu</nonFilteredFileExtension>
</nonFilteredFileExtensions> </nonFilteredFileExtensions>
</configuration> </configuration>
</plugin> </plugin>
<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.7.0</version> <version>3.7.0</version>
<configuration> <configuration>
<source>${java.version}</source> <source>${java.version}</source>
<target>${java.version}</target> <target>${java.version}</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version> <version>2.22.0</version>
</plugin> </plugin>
<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>
<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> <configuration>
<show>public</show> <show>public</show>
<failOnError>false</failOnError> <failOnError>false</failOnError>
<additionalJOption>-Xdoclint:none</additionalJOption> <additionalJOption>-Xdoclint:none</additionalJOption>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
<id>attach-javadocs</id> <id>attach-javadocs</id>
<goals> <goals>
<goal>jar</goal> <goal>jar</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<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>
<executions> <executions>
<execution> <execution>
<id>attach-sources</id> <id>attach-sources</id>
<goals> <goals>
<goal>jar-no-fork</goal> <goal>jar-no-fork</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<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>
<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>
</plugins> <plugin>
</build> <groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.3</version>
<configuration>
<append>true</append>
<excludes>
<!-- This is required to prevent Jacoco from adding
synthetic fields to a JavaBean class (causes errors in testing) -->
<exclude>**/*Names*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>