aboutsummaryrefslogtreecommitdiff
path: root/docker/maven
diff options
context:
space:
mode:
Diffstat (limited to 'docker/maven')
-rw-r--r--docker/maven/Dockerfile21
-rw-r--r--docker/maven/files/pom.xml22
-rw-r--r--docker/maven/readme.md33
3 files changed, 56 insertions, 20 deletions
diff --git a/docker/maven/Dockerfile b/docker/maven/Dockerfile
index a41932c9..ac977a7a 100644
--- a/docker/maven/Dockerfile
+++ b/docker/maven/Dockerfile
@@ -1,18 +1,19 @@
FROM ubuntu:16.04 as downloader
-RUN apt-get update && apt-get install wget -y
-RUN wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_linux-x64_bin.tar.gz -O jdk9_linux-x64_bin.tar.gz
-RUN tar -xzf jdk9_linux-x64_bin.tar.gz -C /opt/
+ARG jdk=1.9
+ADD provision/jdk/ provision/jdk/
+RUN provision/jdk/java-${jdk}.sh
-RUN wget http://www-us.apache.org/dist/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz -O maven.tar.gz
-RUN mkdir /usr/local/apache-maven/ && tar xvf maven.tar.gz -C /usr/local/apache-maven/
+ARG maven=3.5.0
+ADD provision/maven/maven-${maven}.sh provision/maven/maven-${maven}.sh
+RUN provision/maven/maven-${maven}.sh
FROM ubuntu:16.04
COPY --from=downloader /usr/local/apache-maven/ /usr/local/apache-maven/
-COPY --from=downloader /opt/jdk-9.0.1/ /opt/jdk-9.0.1/
+COPY --from=downloader /opt/jdk/ /opt/jdk/
-RUN update-alternatives --install /usr/bin/java java /opt/jdk-9.0.1/bin/java 1000 && update-alternatives --install /usr/bin/javac javac /opt/jdk-9.0.1/bin/javac 1000 && update-alternatives --install /usr/bin/javadoc javadoc /opt/jdk-9.0.1/bin/javadoc 1000 && update-alternatives --install /usr/bin/javap javap /opt/jdk-9.0.1/bin/javap 1000
+RUN update-alternatives --install /usr/bin/java java /opt/jdk/bin/java 1000 && update-alternatives --install /usr/bin/javac javac /opt/jdk/bin/javac 1000 && update-alternatives --install /usr/bin/javadoc javadoc /opt/jdk/bin/javadoc 1000 && update-alternatives --install /usr/bin/javap javap /opt/jdk/bin/javap 1000
WORKDIR workspace
@@ -21,8 +22,10 @@ ADD maven/files/ ./
ARG lombokjar=lombok.jar
ADD https://projectlombok.org/downloads/${lombokjar} lombok.jar
-ENV JAVA_HOME=/opt/jdk-9.0.1
-ENV M2_HOME=/usr/local/apache-maven/apache-maven-3.5.0
+ARG jdk
+ENV JDK_VERSION=${jdk}
+ENV JAVA_HOME=/opt/jdk
+ENV M2_HOME=/usr/local/apache-maven/apache-maven
ENV M2=${M2_HOME}/bin
ENV PATH="${M2}:${JAVA_HOME}/bin:${PATH}"
diff --git a/docker/maven/files/pom.xml b/docker/maven/files/pom.xml
index 9ecd8868..0771e3a9 100644
--- a/docker/maven/files/pom.xml
+++ b/docker/maven/files/pom.xml
@@ -2,12 +2,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
- <artifactId>lombok-jdk9</artifactId>
+ <artifactId>lombok-jdk-${env.JDK_VERSION}</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <java.version>1.9</java.version>
+ <java.version>${env.JDK_VERSION}</java.version>
</properties>
<build>
@@ -25,15 +25,15 @@
<compilerargs>
<arg>-Werror</arg>
<arg>-Xlint:all</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
</compilerargs>
</configuration>
</plugin>
diff --git a/docker/maven/readme.md b/docker/maven/readme.md
new file mode 100644
index 00000000..20cf126f
--- /dev/null
+++ b/docker/maven/readme.md
@@ -0,0 +1,33 @@
+## Configuration
+
+[_(general configuration and options)_](../readme.md)
+
+### `ARG maven=3.5.0`
+
+The maven version to be used. Supported values:
+
+- `3.5.0` (default)
+
+## Example build commands:
+
+(To be executed from the `<lombokhome>/docker` directory)
+
+```
+docker build -t lombok-maven-jdk9 -f maven/Dockerfile .
+
+docker build -t lombok-maven-jdk9 --build-arg lombokjar=lombok-1.16.18.jar -f maven/Dockerfile .
+```
+
+## Example run commands:
+
+```
+docker run -it lombok-maven-jdk9
+
+docker run --rm -it -v /<lombokhome>/dist/lombok.jar:/workspace/lombok.jar lombok-maven-jdk9
+```
+
+## Example container commands:
+
+```
+mvn compile
+```