Skip to content

Commit

Permalink
Add script for running Maven in Docker
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stefanbirkner committed Aug 14, 2021
1 parent a203454 commit d3ce0eb
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ insert_final_newline = true
tab_width = 4
trim_trailing_whitespace = true

[*.{xml,yml}]
[*.{sh,xml,yml}]
indent_size = 2
indent_style = space
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,15 @@ System Lambda supports [GitHub Actions](https://help.github.com/en/actions)
integration. Your pull request will be automatically built by both CI
servers.

### Build with Docker

The script

./scripts/mvn_in_docker.sh clean verify -Dgpg.skip

builds System Lambda inside a Docker container. It uses your Maven local
repository. This is helpful if you have a Linux or macOS without JDK 8.


## Release Guide

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>

<artifactId>system-lambda</artifactId>
<version>1.2.0</version>
<version>1.3.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>System Lambda</name>
Expand Down
26 changes: 26 additions & 0 deletions scripts/mvn_in_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
#
# Executes Maven inside a Docker container with Java 8. The image has to be
# executed with options, phases and goals just like the original mvn command.
# E.g. instead of "mvn verify" you have to execute
#
# scripts/mvn_in_docker.sh verify
#
# from the project directory. The user's Maven local repository is used by the
# container.

set -euxo pipefail

readonly group=`id -g`
readonly user=`id -u`

docker run \
--rm \
-e MAVEN_CONFIG=/var/maven/.m2 \
-u "$user:$group" \
-v "$(pwd)":/usr/src/system-lambda \
-v ~/.m2:/var/maven/.m2 \
-w /usr/src/system-lambda \
maven:3.8.1-openjdk-8-slim \
mvn -Duser.home=/var/maven "$@"
rm -r '?/' # I don't know why this directory is created.

0 comments on commit d3ce0eb

Please sign in to comment.