Last active
October 2, 2020 12:36
-
-
Save lasp73/8220897ee2cc77fb9d78d54cfdeeb0d9 to your computer and use it in GitHub Desktop.
Compile using Maven inside Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MVN_CMD="docker run -t --rm -u $(id -u $USER):$(id -g $USER) \ | |
-v $HOME/.m2:/mnt/maven/.m2 \ | |
-v $PWD:/mnt/code \ | |
-w /mnt/code \ | |
-e MAVEN_CONFIG=/mnt/maven/.m2 \ | |
maven:3-jdk-8 mvn -Duser.home=/mnt/maven" | |
$MVN_CMD "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Build your Java project by executing:
./mvn-docker.sh clean package
This script reuses your Maven repository.