This repository was archived by the owner on Dec 13, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -11,5 +11,8 @@ ENV PATH $JAVA_HOME/bin:$PATH
1111ENV MAVEN_HOME /usr/share/maven
1212ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
1313
14+ COPY mvn-entrypoint.sh /usr/local/bin/mvn-entrypoint.sh
15+ COPY settings-docker.xml /usr/share/maven/ref/
16+
1417ENTRYPOINT ["/usr/local/bin/mvn-entrypoint.sh" ]
1518CMD ["mvn" ]
Original file line number Diff line number Diff line change 1+ #! /bin/bash -eu
2+
3+ set -o pipefail
4+
5+ # Copy files from /usr/share/maven/ref into ${MAVEN_CONFIG}
6+ # So the initial ~/.m2 is set with expected content.
7+ # Don't override, as this is just a reference setup
8+ copy_reference_file () {
9+ local root=" ${1} "
10+ local f=" ${2%/ } "
11+ local logfile=" ${3} "
12+ local rel=" ${f/ ${root} / } " # path relative to /usr/share/maven/ref/
13+ echo " $f " >> " $logfile "
14+ echo " $f -> $rel " >> " $logfile "
15+ if [[ ! -e ${MAVEN_CONFIG} /${rel} || $f = * .override ]]
16+ then
17+ echo " copy $rel to ${MAVEN_CONFIG} " >> " $logfile "
18+ mkdir -p " ${MAVEN_CONFIG} /$( dirname " ${rel} " ) "
19+ cp -r " ${f} " " ${MAVEN_CONFIG} /${rel} " ;
20+ fi ;
21+ }
22+
23+ copy_reference_files () {
24+ local log=" $MAVEN_CONFIG /copy_reference_file.log"
25+
26+ if (sh -c " mkdir -p \" $MAVEN_CONFIG \" && touch \" ${log} \" " > /dev/null 2>&1 )
27+ then
28+ echo " --- Copying files at $( date) " >> " $log "
29+ find /usr/share/maven/ref/ -type f -exec bash -eu -c ' copy_reference_file /usr/share/maven/ref/ "$1" "$2"' _ {} " $log " \;
30+ else
31+ echo " Can not write to ${log} . Wrong volume permissions? Carrying on ..."
32+ fi
33+ }
34+
35+ export -f copy_reference_file
36+ copy_reference_files
37+ unset MAVEN_CONFIG
38+
39+ exec " $@ "
Original file line number Diff line number Diff line change 1+ <settings xmlns =" http://maven.apache.org/SETTINGS/1.0.0"
2+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : schemaLocation =" http://maven.apache.org/SETTINGS/1.0.0
4+ https://maven.apache.org/xsd/settings-1.0.0.xsd" >
5+ <localRepository >/usr/share/maven/ref/repository</localRepository >
6+ </settings >
You can’t perform that action at this time.
0 commit comments