Skip to content

Commit

Permalink
#79 add docker to test jdk version
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Mar 2, 2020
1 parent 6aaa8db commit afcff71
Show file tree
Hide file tree
Showing 6 changed files with 197 additions and 21 deletions.
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<artifactId>maven-processor-plugin-parent</artifactId>
<packaging>pom</packaging>
<version>4.0-SNAPSHOT</version>
<name>MAVEN PROCESSOR PLUGIN :: PARENT</name>
<name>MAVEN PROCESSOR PLUGIN PARENT</name>
<description>A maven plugin to process annotation for jdk6 at compile time

This plugin helps to use from maven the new annotation processing provided by JDK6 integrated in java compiler
Expand Down Expand Up @@ -115,6 +115,11 @@ This plugin could be considered the 'alter ego' of maven apt plugin http://mojo.
<version>3.8.2</version>
</plugin>

<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.33.0</version>
</plugin>
</plugins>

</pluginManagement>
Expand Down
27 changes: 27 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Maven Annotation plugin - test

## Steps for test

Deploy project assets. (valid only for the SNAPSHOT)
> let's go in root folder and run
>```dockerfile
>mvn deploy
>```
Build docker image
> let's go in `test` folder and run
>```dockerfile
>mvn -Pdocker docker:build
>```
Create docker volume
> let's go in `test` folder and run
>```dockerfile
>mvn -Pdocker docker:volume-create
>```
Run test
> let's go in `test` folder and run
>```dockerfile
>mvn -Pdocker docker:rund
>```
89 changes: 69 additions & 20 deletions test/pom.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>

<artifactId>maven-processor-plugin-test</artifactId>
<packaging>jar</packaging>
<name>MAVEN PROCESSOR PLUGIN TEST</name>
<description></description>

<parent>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin-parent</artifactId>
<version>4.0-SNAPSHOT</version>
</parent>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin-test</artifactId>
<packaging>jar</packaging>
<name>MAVEN PROCESSOR PLUGIN TEST</name>
<version>4.0-SNAPSHOT</version>
<description></description>

<properties>
</properties>
<maven.compiler.source>1.9</maven.compiler.source>
<maven.compiler.target>1.9</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>

Expand All @@ -35,11 +34,6 @@
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>1.1</version>
</plugin>
</plugins>

</pluginManagement>
Expand Down Expand Up @@ -166,13 +160,68 @@ PROCESSOR PLUGIN

<profiles>
<profile>
<id>toolchain</id>
<id>docker</id>
<build>
<plugins>

<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<extensions>true</extensions> <!-- enables using 'docker' packaging above -->
<configuration>
<logDate>default</logDate>
<verbose>true</verbose>
<imagePullPolicy>IfNotPresent</imagePullPolicy>
<!--
mvn -Pdocker docker:volume-create
-->
<volumes>
<volume>
<name>mvn-repo</name>
<driver>local</driver>
</volume>
</volumes>
<images>
<image>
<name>maven-3.5.4-jdk9</name>
<!--
mvn -Pdocker docker:build
-->
<build>
<contextDir>.</contextDir>
<tags>
<tag>latest</tag>
<tag>${project.version}</tag>
</tags>
</build>
<!--
mvn -Pdocker docker:build
-->
<run>
<volumes>
<bind>
<volume>mvn-repo:/usr/share/maven/ref/repository</volume>
<volume>${project.basedir}:/home</volume>
</bind>
</volumes>
<cmd>mvn -Ptoolchain clean package -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true</cmd>
</run>
</image>
</images>
</configuration>
</plugin>
</plugins>

</build>
</profile>
<profile>
<id>toolchain</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<goals>
Expand All @@ -183,8 +232,8 @@ PROCESSOR PLUGIN
<configuration>
<toolchains>
<jdk>
<version>1.6</version>
<vendor>sun</vendor>
<version>[1.9,)</version>
<vendor>open</vendor>
</jdk>
</toolchains>
</configuration>
Expand Down
31 changes: 31 additions & 0 deletions test/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM adoptopenjdk/openjdk9

ARG MAVEN_VERSION=3.5.4
ARG USER_HOME_DIR="/root"
ARG SHA=2a803f578f341e164f6753e410413d16ab60fabe31dc491d1fe35c984a5cce696bc71f57757d4538fe7738be04065a216f3ebad4ef7e0ce1bb4c51bc36d6be86
ARG BASE_URL=https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/


RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
&& echo "${SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
&& rm -f /tmp/apache-maven.tar.gz \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn

ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"

COPY mvn-entrypoint.sh /usr/local/bin/mvn-entrypoint.sh
RUN chmod +x /usr/local/bin/mvn-entrypoint.sh

COPY settings-docker.xml /usr/share/maven/ref/settings.xml
COPY toolchains.xml /usr/share/maven/ref

WORKDIR /home

VOLUME /home
VOLUME /usr/share/maven/ref/repository

ENTRYPOINT ["/usr/local/bin/mvn-entrypoint.sh"]
CMD ["mvn"]
51 changes: 51 additions & 0 deletions test/src/main/docker/settings-docker.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>/usr/share/maven/ref/repository</localRepository>


<profiles>
<profile>
<id>sonatype</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>


<pluginRepositories>

<pluginRepository>
<id>sonatype-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>

</pluginRepositories>

<repositories>

<repository>

<id>sonatype-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>

</repositories>

</profile>

</profiles>

</settings>
13 changes: 13 additions & 0 deletions test/src/main/docker/toolchains.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>1.9</version>
<vendor>open</vendor>
<id>openjdk9</id>
</provides>
<configuration>
<jdkHome>/opt/java/openjdk</jdkHome>
</configuration>
</toolchain>
</toolchains>

0 comments on commit afcff71

Please sign in to comment.