Skip to content

Commit d3ce0eb

Browse files
committed
Add script for running Maven in Docker
System Lambda cannot be build with newer JDKs, but some developers don't have JDK 8 installed anymore. The new scripts allows them to build System Lambda without having JDK 8 as long as they have Docker installed.
1 parent a203454 commit d3ce0eb

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ insert_final_newline = true
99
tab_width = 4
1010
trim_trailing_whitespace = true
1111

12-
[*.{xml,yml}]
12+
[*.{sh,xml,yml}]
1313
indent_size = 2
1414
indent_style = space

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,15 @@ System Lambda supports [GitHub Actions](https://help.github.com/en/actions)
358358
integration. Your pull request will be automatically built by both CI
359359
servers.
360360

361+
### Build with Docker
362+
363+
The script
364+
365+
./scripts/mvn_in_docker.sh clean verify -Dgpg.skip
366+
367+
builds System Lambda inside a Docker container. It uses your Maven local
368+
repository. This is helpful if you have a Linux or macOS without JDK 8.
369+
361370

362371
## Release Guide
363372

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</parent>
1010

1111
<artifactId>system-lambda</artifactId>
12-
<version>1.2.0</version>
12+
<version>1.3.0-SNAPSHOT</version>
1313
<packaging>jar</packaging>
1414

1515
<name>System Lambda</name>

scripts/mvn_in_docker.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Executes Maven inside a Docker container with Java 8. The image has to be
4+
# executed with options, phases and goals just like the original mvn command.
5+
# E.g. instead of "mvn verify" you have to execute
6+
#
7+
# scripts/mvn_in_docker.sh verify
8+
#
9+
# from the project directory. The user's Maven local repository is used by the
10+
# container.
11+
12+
set -euxo pipefail
13+
14+
readonly group=`id -g`
15+
readonly user=`id -u`
16+
17+
docker run \
18+
--rm \
19+
-e MAVEN_CONFIG=/var/maven/.m2 \
20+
-u "$user:$group" \
21+
-v "$(pwd)":/usr/src/system-lambda \
22+
-v ~/.m2:/var/maven/.m2 \
23+
-w /usr/src/system-lambda \
24+
maven:3.8.1-openjdk-8-slim \
25+
mvn -Duser.home=/var/maven "$@"
26+
rm -r '?/' # I don't know why this directory is created.

0 commit comments

Comments
 (0)