@@ -255,18 +255,41 @@ log "CAMEL_QUARKUS_PLATFORM_ARTIFACT_ID = $CAMEL_QUARKUS_PLATFORM_ARTIFACT_ID"
255255CAMEL_QUARKUS_PLATFORM_VERSION=" ${CAMEL_QUARKUS_PLATFORM_VERSION:- $QUARKUS_PLATFORM_VERSION } "
256256log " CAMEL_QUARKUS_PLATFORM_VERSION = $CAMEL_QUARKUS_PLATFORM_VERSION "
257257
258- if [[ -z " $QUARKUS_VERSION " && -n " $MRRC_LOCAL " ]]; then
258+ if [[ -z " $QUARKUS_VERSION " && -n " $MRRC_LOCAL " && " $RUN_AGAINST_MRRC_ONLY " == " true " ]]; then
259259 QUARKUS_VERSION=" $( ls " ${MRRC_LOCAL} /io/quarkus/quarkus-core/" 2> /dev/null | head -1) "
260260 log " QUARKUS_VERSION derived from MRRC_LOCAL"
261261fi
262262log " QUARKUS_VERSION = $QUARKUS_VERSION "
263263
264- if [[ -z " $CAMEL_VERSION " && -n " $MRRC_LOCAL " ]]; then
264+ # Validate that QUARKUS_VERSION is set when RUN_AGAINST_MRRC_ONLY is enabled
265+ if [[ " $RUN_AGAINST_MRRC_ONLY " == " true" && -z " $QUARKUS_VERSION " ]]; then
266+ echo " Error: When --run-against-mrrc-only is set, QUARKUS_VERSION must be specified either via:"
267+ echo " 1. --quarkus-version parameter, or"
268+ echo " 2. --mrrc-local (QUARKUS_VERSION will be derived from MRRC)"
269+ exit 1
270+ fi
271+
272+ # Validate that CAMEL_QUARKUS_VERSION is set when RUN_AGAINST_MRRC_ONLY is NOT enabled
273+ if [[ " $RUN_AGAINST_MRRC_ONLY " != " true" && " $UPSTREAM " != " true" && -z " $CAMEL_QUARKUS_VERSION " ]]; then
274+ echo " Error: When --run-against-mrrc-only is NOT set, CAMEL_QUARKUS_VERSION must be specified via:"
275+ echo " --camel-quarkus-version parameter"
276+ exit 1
277+ fi
278+
279+ if [[ -z " $CAMEL_VERSION " && -n " $MRRC_LOCAL " && " $RUN_AGAINST_MRRC_ONLY " == " true" ]]; then
265280 CAMEL_VERSION=" $( ls " ${MRRC_LOCAL} /org/apache/camel/camel-direct/" 2> /dev/null | head -1) "
266281 log " CAMEL_VERSION derived from MRRC_LOCAL"
267282fi
268283log " CAMEL_VERSION = $CAMEL_VERSION "
269284
285+ # Validate that CAMEL_VERSION is set when RUN_AGAINST_MRRC_ONLY is enabled
286+ if [[ " $RUN_AGAINST_MRRC_ONLY " == " true" && -z " $CAMEL_VERSION " ]]; then
287+ echo " Error: When --run-against-mrrc-only is set, CAMEL_VERSION must be specified either via:"
288+ echo " 1. --camel-version parameter, or"
289+ echo " 2. --mrrc-local (CAMEL_VERSION will be derived from MRRC)"
290+ exit 1
291+ fi
292+
270293# Build common Maven arguments
271294COMMON_MVN_ARGS=" -B -ntp -Dformatter.skip -Dimpsort.skip -Denforcer.skip -DbuildMetaData.skip -Dcq.camel-prod-excludes.skip=true -Dcamel-quarkus.update-extension-doc-page.skip -Djava.home=$JAVA_HOME "
272295
@@ -310,7 +333,7 @@ if [[ "$TEST_ONLY" != "true" ]]; then
310333 # Hack to fix the missing Jetty BOM (CEQ-8802)
311334 if [[ -f " poms/bom/src/main/generated/flattened-reduced-pom.xml" ]]; then
312335 log " Copying flattened-reduced-pom.xml to poms/bom/pom.xml"
313- cp poms/bom/src/main/generated/flattened-reduced-pom.xml poms/bom/pom.xml
336+ cp poms/bom/src/main/generated/flattened-reduced-pom.xml poms/bom/pom.xml || exit $?
314337 fi
315338
316339 # Replace Camel version in the top pom.xml
@@ -321,10 +344,43 @@ cd /*[local-name()="project"]/*[local-name()="parent"]/*[local-name()="version"]
321344set $CAMEL_VERSION
322345save
323346EOF
347+ if [[ $? -ne 0 ]]; then
348+ echo " Error: Failed to replace Camel parent version in pom.xml"
349+ exit 1
350+ fi
351+
324352 xmllint --shell pom.xml << EOF
325353cd /*[local-name()="project"]/*[local-name()="properties"]/*[local-name()="camel.version"]
326354set $CAMEL_VERSION
327355save
356+ EOF
357+ if [[ $? -ne 0 ]]; then
358+ echo " Error: Failed to replace Camel version property in pom.xml"
359+ exit 1
360+ fi
361+ fi
362+
363+ # Replace Quarkus version in the top pom.xml
364+ if [[ -n " $QUARKUS_VERSION " ]]; then
365+ log " Replacing Quarkus version to $QUARKUS_VERSION in pom.xml"
366+ xmllint --shell pom.xml << EOF
367+ cd /*[local-name()="project"]/*[local-name()="properties"]/*[local-name()="quarkus.version"]
368+ set $QUARKUS_VERSION
369+ save
370+ EOF
371+ if [[ $? -ne 0 ]]; then
372+ echo " Error: Failed to replace Quarkus version property in pom.xml"
373+ exit 1
374+ fi
375+ fi
376+
377+ # Replace Quarkus version in the top pom.xml
378+ if [[ -n " $QUARKUS_VERSION " ]]; then
379+ log " Replacing Quarkus version to $QUARKUS_VERSION in pom.xml"
380+ xmllint --shell pom.xml << EOF
381+ cd /*[local-name()="project"]/*[local-name()="properties"]/*[local-name()="quarkus.version"]
382+ set $QUARKUS_VERSION
383+ save
328384EOF
329385 fi
330386 fi
354410 $SETTINGS_XML_ARG \
355411 $MVN_EXTRA \
356412 $module
413+ MVN_EXIT_CODE=$?
414+ if [[ $MVN_EXIT_CODE -ne 0 ]]; then
415+ echo " Error: Maven build failed for module $module with exit code $MVN_EXIT_CODE "
416+ exit $MVN_EXIT_CODE
417+ fi
357418 done
358419 fi
359420fi
0 commit comments