Skip to content

Commit 2e7512b

Browse files
committed
fix(manifest): keep the Maven extension build out of the developer's home directory
The maven-extension jar build invoked the bundled Maven wrapper with no repository override, so every run downloaded the plugin and dependency closure into the developer's ~/.m2/repository and the Maven distribution into ~/.m2/wrapper/dists. Point both at a stable directory under the OS temp dir instead. The path is stable rather than per-run so the closure stays cached between builds; SOCKET_CLI_MAVEN_HOME overrides it for a genuinely cold build.
1 parent 4379347 commit 2e7512b

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

  • packages/cli/src/commands/manifest/scripts/maven-extension

packages/cli/src/commands/manifest/scripts/maven-extension/build-jar.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@
55
set -euo pipefail
66

77
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8-
( cd "$here" && ./mvnw -q --batch-mode package )
8+
9+
# Keep the downloaded artifacts and the Maven distribution out of the developer's ~/.m2. The path is
10+
# stable so the plugin closure stays cached between runs; point SOCKET_CLI_MAVEN_HOME elsewhere for a
11+
# cold build.
12+
tmp_root="${TMPDIR:-/tmp}"
13+
maven_home="${SOCKET_CLI_MAVEN_HOME:-${tmp_root%/}/socket-cli-maven-home}"
14+
mkdir -p "$maven_home"
15+
16+
(
17+
cd "$here"
18+
MAVEN_USER_HOME="$maven_home" ./mvnw -q --batch-mode \
19+
-Dmaven.repo.local="$maven_home/repository" package
20+
)
921
cp -f "$here/target/coana-maven-extension.jar" "$here/coana-maven-extension.jar"
1022
echo "Coana Maven extension jar: $here/coana-maven-extension.jar"

0 commit comments

Comments
 (0)