You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@auron.apache.org by "guixiaowen (via GitHub)" <gi...@apache.org> on 2026/05/03 04:28:36 UTC
[PR] [AURON #2227]auron-build.sh fails to parse options after -D arguments [auron]
guixiaowen opened a new pull request, #2228:
URL: https://github.com/apache/auron/pull/2228
# Which issue does this PR close?
Closes #2227
# Rationale for this change
When a -D Maven system property (e.g. -DskipBuildNative) appears before other command-line options, the script stops parsing further arguments, causing valid options after it to be ignored.
EG
sh auron-build.sh --pre --sparkver 3.5 --scalaver 2.12 -DskipBuildNative --sparktests true
Once a -D* argument is encountered, the argument parsing stops (due to break logic in -* handler).
Any options appearing after -D* (e.g. --sparktests, --sparkver) are not parsed.
ERROR INFO
`
[INFO] Starting Apache Auron build...
Unable to parse command line options: Unrecognized option: --sparktests
usage: mvn [options] [<goal(s)>] [<phase(s)>]
Options:
-am,--also-make If project list is specified,
also build projects required by
`
# What changes are included in this PR?
Handle -D* separately and do not break parsing:
After this PR change, the build command now executes correctly.
sh auron-build.sh --pre --sparkver 3.5 --scalaver 2.12 -DskipBuildNative --sparktests true
sh auron-build.sh --pre --sparkver 3.5 --scalaver 2.12 -DskipBuildNative --sparktests true -Dscalafix.mode=CHECK
# Are there any user-facing changes?
# How was this patch tested?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@auron.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [AURON #2227] auron-build.sh fails to parse options after -D arguments [auron]
Posted by "slfan1989 (via GitHub)" <gi...@apache.org>.
slfan1989 commented on PR #2228:
URL: https://github.com/apache/auron/pull/2228#issuecomment-4376653870
@guixiaowen Thanks for the contribution! @ShreyeshArangath Thanks for the review!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@auron.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [AURON #2227] auron-build.sh fails to parse options after -D arguments [auron]
Posted by "slfan1989 (via GitHub)" <gi...@apache.org>.
slfan1989 merged PR #2228:
URL: https://github.com/apache/auron/pull/2228
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@auron.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [AURON #2227] auron-build.sh fails to parse options after -D arguments [auron]
Posted by "guixiaowen (via GitHub)" <gi...@apache.org>.
guixiaowen commented on PR #2228:
URL: https://github.com/apache/auron/pull/2228#issuecomment-4417732370
> @guixiaowen Thanks for the contribution! @ShreyeshArangath Thanks for the review!
@slfan1989 @ShreyeshArangath Thanks for your review and merge.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@auron.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [AURON #2227] auron-build.sh fails to parse options after -D arguments [auron]
Posted by "ShreyeshArangath (via GitHub)" <gi...@apache.org>.
ShreyeshArangath commented on code in PR #2228:
URL: https://github.com/apache/auron/pull/2228#discussion_r3178563070
##########
auron-build.sh:
##########
@@ -348,7 +350,14 @@ while [[ $# -gt 0 ]]; do
exit 1
;;
-*)
- break
+ if [[ "$1" == -D* ]]; then
+ # Maven system property,继续解析
+ MAVEN_OPTS="$MAVEN_OPTS $1"
+ shift
+ else
+ # 其他短参数:停止解析
Review Comment:
We might want to keep this in English 😅
##########
auron-build.sh:
##########
@@ -562,6 +571,11 @@ if [[ "$USE_DOCKER" == true ]]; then
export BUILD_CONTEXT="./${IMAGE_NAME}"
exec docker-compose -f dev/docker-build/docker-compose.yml up --abort-on-container-exit
else
- echo "[INFO] Compiling locally with maven args: $MVN_CMD ${MVN_ARGS[@]} $@"
- "$MVN_CMD" "${MVN_ARGS[@]}" "$@"
+ echo "[INFO] Compiling locally with maven args: $MVN_CMD ${MVN_ARGS[@]} ${MAVEN_OPTS} $@"
+ if [[ -n "$MAVEN_OPTS" ]]; then
+ "$MVN_CMD" "${MVN_ARGS[@]}" "${MAVEN_OPTS}" "$@"
Review Comment:
I think Maven will misinterpret multi-property invocations.
L574 passes the accumulator as a quoted scalar:
```
"$MVN_CMD" "${MVN_ARGS[@]}" "${MAVEN_OPTS}" "$@"
```
Because `MAVEN_OPTS` is built by string concatenation (`MAVEN_OPTS="$MAVEN_OPTS $1"` at L356), with two properties it becomes the single string `" -DskipBuildNative -Dscalafix.mode=CHECK"` The leading space will be preserved. Quoting it passes that as ONE `argv` slot to `mvn`. Maven will see one argument that starts with a space, not two -D properties.
It might make more sense to make MAVEN_OPTS an array, WDYT?
```
MAVEN_OPTS=() # init
MAVEN_OPTS+=("$1"); shift # accumulate
"$MVN_CMD" "${MVN_ARGS[@]}" "${MAVEN_OPTS[@]}" "$@" # expand
```
##########
auron-build.sh:
##########
@@ -139,6 +139,7 @@ UNIFFLE_VER=""
PAIMON_VER=""
ICEBERG_VER=""
HUDI_VER=""
+MAVEN_OPTS=""
Review Comment:
nit: MAVEN_OPTS is the environment variable used by Maven, might be better to have a different variable name here to help with debugging avoid confusion.
Try `MVN_D_ARGS`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@auron.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [AURON #2227] auron-build.sh fails to parse options after -D arguments [auron]
Posted by "guixiaowen (via GitHub)" <gi...@apache.org>.
guixiaowen commented on code in PR #2228:
URL: https://github.com/apache/auron/pull/2228#discussion_r3179048669
##########
auron-build.sh:
##########
@@ -562,6 +571,11 @@ if [[ "$USE_DOCKER" == true ]]; then
export BUILD_CONTEXT="./${IMAGE_NAME}"
exec docker-compose -f dev/docker-build/docker-compose.yml up --abort-on-container-exit
else
- echo "[INFO] Compiling locally with maven args: $MVN_CMD ${MVN_ARGS[@]} $@"
- "$MVN_CMD" "${MVN_ARGS[@]}" "$@"
+ echo "[INFO] Compiling locally with maven args: $MVN_CMD ${MVN_ARGS[@]} ${MAVEN_OPTS} $@"
+ if [[ -n "$MAVEN_OPTS" ]]; then
+ "$MVN_CMD" "${MVN_ARGS[@]}" "${MAVEN_OPTS}" "$@"
Review Comment:
> I think Maven will misinterpret multi-property invocations.
>
> L574 passes the accumulator as a quoted scalar:
>
> ```
> "$MVN_CMD" "${MVN_ARGS[@]}" "${MAVEN_OPTS}" "$@"
> ```
>
> Because `MAVEN_OPTS` is built by string concatenation (`MAVEN_OPTS="$MAVEN_OPTS $1"` at L356), with two properties it becomes the single string `" -DskipBuildNative -Dscalafix.mode=CHECK"` The leading space will be preserved. Quoting it passes that as ONE `argv` slot to `mvn`. Maven will see one argument that starts with a space, not two -D properties.
>
> It might make more sense to make MAVEN_OPTS an array, WDYT?
>
> ```
> MAVEN_OPTS=() # init
> MAVEN_OPTS+=("$1"); shift # accumulate
> "$MVN_CMD" "${MVN_ARGS[@]}" "${MAVEN_OPTS[@]}" "$@" # expand
> ```
@ShreyeshArangath Thank you very much for reviewing the code.
I used this approach before, but if `MAVEN_OPTS` is empty and no `-D` parameters are passed, an error will occur and the unit tests cannot pass. The error message is as follows:
“Error: Unknown lifecycle phase "". You must specify a valid lifecycle phase or a goal in the format `<plugin-prefix>:<goal>` or `<plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>`. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy. -> [Help 1]”
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@auron.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [AURON #2227] auron-build.sh fails to parse options after -D arguments [auron]
Posted by "guixiaowen (via GitHub)" <gi...@apache.org>.
guixiaowen commented on code in PR #2228:
URL: https://github.com/apache/auron/pull/2228#discussion_r3179046008
##########
auron-build.sh:
##########
@@ -348,7 +350,14 @@ while [[ $# -gt 0 ]]; do
exit 1
;;
-*)
- break
+ if [[ "$1" == -D* ]]; then
+ # Maven system property,继续解析
+ MAVEN_OPTS="$MAVEN_OPTS $1"
+ shift
+ else
+ # 其他短参数:停止解析
Review Comment:
> We might want to keep this in English 😅
@ShreyeshArangath Thank you very much for reviewing the code. I have already made the revisions. Thank you.
##########
auron-build.sh:
##########
@@ -139,6 +139,7 @@ UNIFFLE_VER=""
PAIMON_VER=""
ICEBERG_VER=""
HUDI_VER=""
+MAVEN_OPTS=""
Review Comment:
> nit: MAVEN_OPTS is the environment variable used by Maven, might be better to have a different variable name here to help with debugging avoid confusion.
>
> Try `MVN_D_ARGS`?
@guixiaowen Thank you very much for reviewing the code. I have already made the revisions. Thank you.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@auron.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org