Skip to content

Commit

Permalink
Setup maven workflow actions on gitub
Browse files Browse the repository at this point in the history
- Create maven.yml
- Create ubuntu-toolchains.xml
  • Loading branch information
mprins committed Jan 29, 2020
1 parent 852ef90 commit c629cd9
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/ubuntu-toolchains.xml
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF8"?>
<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 http://maven.apache.org/xsd/toolchains-1.1.0.xsd">
<toolchain>
<type>jdk</type>
<provides>
<version>11</version>
</provides>
<configuration>
<jdkHome>${env.JAVA_HOME_11_X64}</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>1.8</version>
</provides>
<configuration>
<jdkHome>${env.JAVA_HOME_8_X64}</jdkHome>
</configuration>
</toolchain>
</toolchains>
40 changes: 40 additions & 0 deletions .github/workflows/maven.yml
@@ -0,0 +1,40 @@
name: Maven GH build

on: [push]

jobs:
build:
name: Java ${{ matrix.java }} build
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8, 11 ]

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1.1.0
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11 for toolchains
uses: actions/setup-java@v1.3.0
with:
java-version: 11
- name: Set up JDK 8 for toolchains
uses: actions/setup-java@v1.3.0
with:
java-version: 8
- name: Set up JDK
uses: actions/setup-java@v1.3.0
with:
java-version: ${{ matrix.java }}
- name: Inspect environment
run: |
set | grep JAVA
- name: Build with Maven
run: mvn -V -B -e package --global-toolchains .github/ubuntu-toolchains.xml
- name: Remove SNAPSHOT jars from repository
run: |
find ~/.m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}
36 changes: 36 additions & 0 deletions pom.xml
Expand Up @@ -416,4 +416,40 @@
</plugin>
</plugins>
</reporting>
<profiles>
<profile>
<id>java11</id>
<activation>
<jdk>11</jdk>
</activation>
<properties>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.6.0</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit c629cd9

Please sign in to comment.