@@ -36,6 +36,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -qq update && \
3636 wget='1.21.2-*' \
3737 shellcheck='0.8.0-*' \
3838 patch='2.7.6-*' \
39+ libxml2-dev='2.9.13+dfsg-*' \
40+ libxml2-utils='2.9.13+dfsg-*' \
3941 && \
4042 apt-get clean && \
4143 rm -rf /var/lib/apt/lists/* \
@@ -110,14 +112,56 @@ ENV MAVEN_HOME='/opt/maven'
110112RUN mv /opt/maven/bin/mvn /opt/maven/bin/mvn-original && \
111113 cat > /opt/maven/bin/mvn <<'EOF'
112114# !/bin/bash
113- TOOLCHAIN="${BASEDIR}/dev-support/toolchains-jenkins.xml"
114- if [ -f "$TOOLCHAIN" ]; then
115+
116+ echo "Maven wrapper called with args: $@"
117+ echo "Current working directory: $(pwd)"
118+ echo "BASEDIR environment variable: ${BASEDIR:-'(not set)'}"
119+ echo "MAVEN_HOME: ${MAVEN_HOME:-'(not set)'}"
120+
121+ # Ensure Maven home exists
122+ if [ ! -d "${MAVEN_HOME}" ]; then
123+ echo "ERROR: MAVEN_HOME directory does not exist: ${MAVEN_HOME}"
124+ exit 1
125+ fi
126+
127+ if [ ! -f "${MAVEN_HOME}/bin/mvn-original" ]; then
128+ echo "ERROR: mvn-original not found at: ${MAVEN_HOME}/bin/mvn-original"
129+ exit 1
130+ fi
131+
132+ # Try multiple possible locations for the toolchains file
133+ TOOLCHAIN_LOCATIONS=(
134+ "${BASEDIR}/dev-support/toolchains-jenkins.xml"
135+ "$(pwd)/dev-support/toolchains-jenkins.xml"
136+ "./dev-support/toolchains-jenkins.xml"
137+ "../dev-support/toolchains-jenkins.xml"
138+ )
139+
140+ TOOLCHAIN=""
141+ for location in "${TOOLCHAIN_LOCATIONS[@]}" ; do
142+ echo "Checking for toolchains file at: $location"
143+ if [ -f "$location" ]; then
144+ TOOLCHAIN="$location"
145+ echo "Found toolchains file at: $TOOLCHAIN"
146+ break
147+ fi
148+ done
149+
150+ if [ -n "$TOOLCHAIN" ]; then
115151 echo "Added: -t ${TOOLCHAIN} to mvn flags!"
116- exec ${MAVEN_HOME}/bin/mvn-original "$@" -t "$TOOLCHAIN"
152+ echo "Executing: ${MAVEN_HOME}/bin/mvn-original $@ -t $TOOLCHAIN"
153+ "${MAVEN_HOME}/bin/mvn-original" "$@" -t "$TOOLCHAIN"
154+ exit_code=$?
117155else
118- echo "Unexpected: ${TOOLCHAIN} file is missing!"
119- exec ${MAVEN_HOME}/bin/mvn-original "$@"
156+ echo "Error: toolchains-jenkins.xml file not found in any expected location, please fix the build environment!"
157+ echo "Proceeding without toolchains configuration..."
158+ echo "Executing: ${MAVEN_HOME}/bin/mvn-original $@"
159+ "${MAVEN_HOME}/bin/mvn-original" "$@"
160+ exit_code=$?
120161fi
162+
163+ echo "Maven execution completed with exit code: $exit_code"
164+ exit $exit_code
121165EOF
122166RUN chmod +x /opt/maven/bin/mvn && cat /opt/maven/bin/mvn
123167
0 commit comments