diff --git a/packages/cli/src/commands/manifest/scripts/maven-extension/build-jar.sh b/packages/cli/src/commands/manifest/scripts/maven-extension/build-jar.sh index eeaef2f67..5ca607bd8 100755 --- a/packages/cli/src/commands/manifest/scripts/maven-extension/build-jar.sh +++ b/packages/cli/src/commands/manifest/scripts/maven-extension/build-jar.sh @@ -5,6 +5,18 @@ set -euo pipefail here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -( cd "$here" && ./mvnw -q --batch-mode package ) + +# Keep the downloaded artifacts and the Maven distribution out of the developer's ~/.m2. The path is +# stable so the plugin closure stays cached between runs; point SOCKET_CLI_MAVEN_HOME elsewhere for a +# cold build. +tmp_root="${TMPDIR:-/tmp}" +maven_home="${SOCKET_CLI_MAVEN_HOME:-${tmp_root%/}/socket-cli-maven-home}" +mkdir -p "$maven_home" + +( + cd "$here" + MAVEN_USER_HOME="$maven_home" ./mvnw -q --batch-mode \ + -Dmaven.repo.local="$maven_home/repository" package +) cp -f "$here/target/coana-maven-extension.jar" "$here/coana-maven-extension.jar" echo "Coana Maven extension jar: $here/coana-maven-extension.jar"