The Unified and Autonomous Development Platform
chore: Refactor Maven command handling in dev.sh for improved flexibility
Robin Shen6cace3687d18
diff --git a/dev.sh b/dev.shindex 7a5b7bc3b0..53ae539f16 100755--- a/dev.sh+++ b/dev.sh@@ -12,6 +12,14 @@ HOTSWAP_AGENT_VERSION=2.0.3ECJ_VERSION=3.38.0MAVEN_REPOSITORY="${MAVEN_REPOSITORY:-$HOME/.m2/repository}"+run_maven() {+ if [ -f server-ee/pom.xml ]; then+ mvn "$@"+ else+ mvn -Pce "$@"+ fi+}+artifact_path() {group_path=$(echo "$1" | tr . /)echo "$MAVEN_REPOSITORY/$group_path/$2/$3/$2-$3.jar"@@ -21,7 +29,7 @@ ensure_artifact() {artifact=$(artifact_path "$1" "$2" "$3")if [ ! -f "$artifact" ]; thenecho "Downloading $1:$2:$3..." >&2- mvn -q -U dependency:get -Dmaven.repo.local="$MAVEN_REPOSITORY" \+ run_maven -U dependency:get -Dmaven.repo.local="$MAVEN_REPOSITORY" \-Dartifact="$1:$2:$3:jar" -Dtransitive=falsefiif [ ! -f "$artifact" ]; then@@ -32,7 +40,7 @@ ensure_artifact() {}build_classpath() {- mvn -pl server-product -q dependency:build-classpath \+ run_maven -pl server-product dependency:build-classpath \-Dmdep.outputFile=target/deps-classpath.txtmodule_cp=$(find . -path '*/target/classes' -type d ! -path '*/bin/*' \@@ -107,7 +115,7 @@ build_project() {if [ ! -d "$build_reference" ]; thenecho "Development sandbox not found. Running: mvn compile"- mvn compile+ run_maven compileif [ ! -d "$build_reference" ]; thenecho "Maven compile did not create $build_reference" >&2exit 1@@ -121,13 +129,13 @@ build_project() {if [ -n "$changed_poms" ]; thenif echo "$changed_poms" | grep -qx './pom.xml'; thenecho "Root pom.xml changed. Running: mvn compile"- mvn compile+ run_maven compileelsemodules=$(echo "$changed_poms" | while read -r pom; dodirname "${pom#./}"done | sort -u | paste -sd, -)echo "Module POM changes detected. Running: mvn -pl $modules -am -amd compile"- mvn -pl "$modules" -am -amd compile+ run_maven -pl "$modules" -am -amd compilefitouch "$build_reference"return@@ -159,7 +167,7 @@ case "$1" in;;clean)shift- mvn clean "$@"+ run_maven clean "$@"exit;;run)