[DEV] integrate maven build

This commit is contained in:
Edouard DUPIN 2020-08-28 17:25:46 +02:00
parent 672e37844e
commit ff822ada9a
4 changed files with 99 additions and 13 deletions

View File

@ -1,38 +1,52 @@
image: heeroyui/scenarium-gitlabci:latest
before_script:
- ls ~/javaFXSDK/javafx-sdk-14/lib
- ls ~
variables:
MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode"
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
JAVA_TOOL_OPTIONS: "-Dfile.encoding=UTF8"
cache:
paths:
- .m2/repository/
- target/
stages:
- style
- build
- test
- package
style_job:
stage: style
script:
- export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
- java -jar checkstyle.jar -c CheckStyle.xml `find src/ -name "*.java"`
- java -jar checkstyle.jar -c CheckStyle.xml `find test/src/ -name "*.java"`
- java -jar ~/checkstyle.jar -c CheckStyle.xml `find src/ -name "*.java"`
- java -jar ~/checkstyle.jar -c CheckStyle.xml `find test/src/ -name "*.java"`
build_job:
stage: build
dependencies:
- style_job
script:
- export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
- eval echo "~$USER"
- ant clean
- ant build
- mvn $MAVEN_CLI_OPTS compile
test_job:
stage: test
dependencies:
- build_job
script:
- export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
- ant clean build TestBasicLog
- mvn $MAVEN_CLI_OPTS test
artifacts:
reports:
junit: junit/TEST-*.xml
package_job:
stage: package
dependencies:
- test_job
script:
- mvn $MAVEN_CLI_OPTS package
artifacts:
when: on_success
expire_in: 1 day
paths:
- target/*.jar

72
pom.xml Normal file
View File

@ -0,0 +1,72 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>scenarium-logger</groupId>
<artifactId>scenarium-logger</artifactId>
<version>0.1.0</version>
<description>Scenarium generic logger</description>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test/src</testSourceDirectory>
<testResources>
<testResource>
<directory>test/src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
<plugins>
<!-- Build the application or the library or the plug-in -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>14</release>
</configuration>
</plugin>
<!-- Create the source bundle -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Create coverage -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Binary file not shown.

View File

@ -8,7 +8,7 @@
******************************************************************************/
package test.scenarium.logger;
import org.junit.Test;
import org.junit.jupiter.api.Test;
public class TestBasicLog {