From afcff71d8a5b9f4ef02a14bc77fcccbe10787037 Mon Sep 17 00:00:00 2001 From: bartolomeo sorrentino Date: Mon, 2 Mar 2020 19:56:28 +0100 Subject: [PATCH] #79 add docker to test jdk version --- pom.xml | 7 +- test/README.md | 27 +++++++ test/pom.xml | 89 ++++++++++++++++++------ test/src/main/docker/Dockerfile | 31 +++++++++ test/src/main/docker/settings-docker.xml | 51 ++++++++++++++ test/src/main/docker/toolchains.xml | 13 ++++ 6 files changed, 197 insertions(+), 21 deletions(-) create mode 100644 test/README.md create mode 100644 test/src/main/docker/Dockerfile create mode 100644 test/src/main/docker/settings-docker.xml create mode 100644 test/src/main/docker/toolchains.xml diff --git a/pom.xml b/pom.xml index 662deb3..5e9bf13 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ maven-processor-plugin-parent pom 4.0-SNAPSHOT - MAVEN PROCESSOR PLUGIN :: PARENT + MAVEN PROCESSOR PLUGIN PARENT 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 @@ -115,6 +115,11 @@ This plugin could be considered the 'alter ego' of maven apt plugin http://mojo. 3.8.2 + + io.fabric8 + docker-maven-plugin + 0.33.0 + diff --git a/test/README.md b/test/README.md new file mode 100644 index 0000000..7ad8adc --- /dev/null +++ b/test/README.md @@ -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 +>``` diff --git a/test/pom.xml b/test/pom.xml index d3242f4..80ebf84 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -1,20 +1,19 @@ - 4.0.0 + 4.0.0 - maven-processor-plugin-test - jar - MAVEN PROCESSOR PLUGIN TEST - - - - org.bsc.maven - maven-processor-plugin-parent - 4.0-SNAPSHOT - + org.bsc.maven + maven-processor-plugin-test + jar + MAVEN PROCESSOR PLUGIN TEST + 4.0-SNAPSHOT + - + 1.9 + 1.9 + UTF-8 + @@ -35,11 +34,6 @@ build-helper-maven-plugin 1.7 - - org.apache.maven.plugins - maven-toolchains-plugin - 1.1 - @@ -166,13 +160,68 @@ PROCESSOR PLUGIN - toolchain + docker + + io.fabric8 + docker-maven-plugin + true + + default + true + IfNotPresent + + + + mvn-repo + local + + + + + maven-3.5.4-jdk9 + + + . + + latest + ${project.version} + + + + + + + mvn-repo:/usr/share/maven/ref/repository + ${project.basedir}:/home + + + mvn -Ptoolchain clean package -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true + + + + + + + + + + + toolchain + + org.apache.maven.plugins maven-toolchains-plugin + 3.0.0 @@ -183,8 +232,8 @@ PROCESSOR PLUGIN - 1.6 - sun + [1.9,) + open diff --git a/test/src/main/docker/Dockerfile b/test/src/main/docker/Dockerfile new file mode 100644 index 0000000..fcf8e84 --- /dev/null +++ b/test/src/main/docker/Dockerfile @@ -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"] \ No newline at end of file diff --git a/test/src/main/docker/settings-docker.xml b/test/src/main/docker/settings-docker.xml new file mode 100644 index 0000000..0cb2f78 --- /dev/null +++ b/test/src/main/docker/settings-docker.xml @@ -0,0 +1,51 @@ + + /usr/share/maven/ref/repository + + + + + sonatype + + true + + + + + + + sonatype-repo + https://oss.sonatype.org/content/repositories/snapshots + + false + + + true + + + + + + + + + + sonatype-repo + https://oss.sonatype.org/content/repositories/snapshots + + false + + + true + + + + + + + + + + \ No newline at end of file diff --git a/test/src/main/docker/toolchains.xml b/test/src/main/docker/toolchains.xml new file mode 100644 index 0000000..dd3635c --- /dev/null +++ b/test/src/main/docker/toolchains.xml @@ -0,0 +1,13 @@ + + + jdk + + 1.9 + open + openjdk9 + + + /opt/java/openjdk + + + \ No newline at end of file