jenkins: don't bind mount .m2
diff --git a/Dockerfile b/Dockerfile
index 662762f..75fca62 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -19,3 +19,7 @@
# Install necessary binaries to build brooklyn-library
RUN apk add --no-cache git procps
+
+RUN mkdir -p /var/maven/.m2/ && chmod -R 777 /var/maven/
+ENV MAVEN_CONFIG=/var/maven/.m2
+
diff --git a/Jenkinsfile b/Jenkinsfile
index 76a41e3..67c1b79 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -36,16 +36,16 @@
}
stage('Run tests') {
- environmentDockerImage.inside('-i --name brooklyn-${DOCKER_TAG} -u 910:910 -v ${WORKSPACE}/.m2:/var/maven/.m2 -v ${WORKSPACE}:/usr/build -w /usr/build -e MAVEN_CONFIG=/var/maven/.m2') {
- sh 'mvn clean install -Duser.name=$(id -un 910)'
+ environmentDockerImage.inside('-i --name brooklyn-${DOCKER_TAG} -u 910:910 --mount type=bind,source="${HOME}/.m2/settings.xml",target=/var/maven/.m2/settings.xml,readonly -v ${WORKSPACE}:/usr/build -w /usr/build') {
+ sh 'mvn clean install -Duser.home=/var/maven -Duser.name=$(id -un 910)'
}
}
// Conditional stage to deploy artifacts, when not building a PR
if (env.CHANGE_ID == null) {
stage('Deploy artifacts') {
- environmentDockerImage.inside('-i --name brooklyn-${DOCKER_TAG} -u 910:910 -v ${WORKSPACE}/.m2:/var/maven/.m2 -v ${WORKSPACE}:/usr/build -w /usr/build -e MAVEN_CONFIG=/var/maven/.m2') {
- sh 'mvn deploy -DskipTests -Duser.name=$(id -un 910)'
+ environmentDockerImage.inside('-i --name brooklyn-${DOCKER_TAG} -u 910:910 -v ${WORKSPACE}:/usr/build -w /usr/build') {
+ sh 'mvn deploy -DskipTests -Duser.home=/var/maven -Duser.name=$(id -un 910)'
}
}
diff --git a/README.md b/README.md
index 147295e..7cc40b2 100644
--- a/README.md
+++ b/README.md
@@ -4,12 +4,20 @@
### Library of Entities for Apache Brooklyn
This sub-project contains various entities not *needed* for Brooklyn,
-but useful in practice as building blocks, including entities for webapps,
+but useful as building blocks, including entities for webapps,
datastores, and more.
### Building the project
-2 methods are available to build this project: within a docker container or directly with maven.
+Two methods are available to build this project: within a docker container or directly with maven.
+
+#### Using maven
+
+Simply run:
+
+```bash
+mvn clean install
+```
#### Using docker
@@ -23,16 +31,18 @@
Then run the build:
```bash
-docker run -i --rm --name brooklyn-library -u $(id -u $(whoami)):$(id -g $(whoami)) \
- -e MAVEN_CONFIG=/var/maven/.m2 \
- -v ${HOME}/.m2:/var/maven/.m2 -v ${PWD}:/usr/build -w /usr/build \
- brooklyn:library mvn clean install -Duser.home=/var/maven -Duser.name=$(whoami)
+docker run -i --rm --name brooklyn-library -u $(id -u):$(id -g) \
+ --mount type=bind,source="${HOME}/.m2/settings.xml",target=/var/maven/.m2/settings.xml,readonly \
+ -v ${PWD}:/usr/build -w /usr/build \
+ brooklyn:library mvn clean install -Duser.home=/var/maven -Duser.name=$(id -un)
+
```
-### Using maven
-
-Simply run:
-
-```bash
-mvn clean install
+You can speed this up by using your local .m2 cache:
```
+docker run -i --rm --name brooklyn-library -u $(id -u):$(id -g) \
+ -v ${HOME}/.m2:/var/maven/.m2 \
+ -v ${PWD}:/usr/build -w /usr/build \
+ brooklyn:library mvn clean install -Duser.home=/var/maven -Duser.name=$(id -un)
+```
+
diff --git a/software/webapp/pom.xml b/software/webapp/pom.xml
index 9a77f99..b58b012 100644
--- a/software/webapp/pom.xml
+++ b/software/webapp/pom.xml
@@ -48,6 +48,7 @@
-->
<exclude>src/main/resources/org/apache/brooklyn/entity/webapp/jboss/jboss7-standalone.xml</exclude>
<exclude>src/main/resources/org/apache/brooklyn/entity/webapp/jetty/jetty-brooklyn.xml</exclude>
+ <exclude>**/.brooklyn/brooklyn-persisted-state/**</exclude>
</excludes>
</configuration>
</plugin>