Skip to content

Commit 0653e8b

Browse files
authored
build: switch SDK Maven build to MAVEN_ARGS (Maven 3.9.9) (#8864)
1 parent dab62e5 commit 0653e8b

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

Dockerfile.sdk

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ARG TRITON_CORE_REPO_TAG=main
3838
ARG TRITON_CLIENT_REPO_TAG=main
3939
ARG TRITON_THIRD_PARTY_REPO_TAG=main
4040
ARG TRITON_ENABLE_GPU=ON
41-
ARG JAVA_BINDINGS_MAVEN_VERSION=3.8.4
41+
ARG JAVA_BINDINGS_MAVEN_VERSION=3.9.9
4242
ARG JAVA_BINDINGS_JAVACPP_PRESETS_TAG=1.5.8
4343
# DCGM version to install for Model Analyzer
4444
ARG DCGM_VERSION=4.5.3-1
@@ -71,7 +71,6 @@ RUN apt-get update && \
7171
libopencv-dev \
7272
libssl-dev \
7373
libtool \
74-
maven \
7574
openjdk-11-jdk \
7675
pkg-config \
7776
python3 \
@@ -88,6 +87,16 @@ RUN apt-get update && \
8887

8988
ENV CMAKE_POLICY_MINIMUM_REQUIRED=3.5
9089

90+
# Install Maven 3.9+ manually -- the distro-provided maven is too old to
91+
# honor the MAVEN_ARGS environment variable (added in Maven 3.9.0, MNG-7038).
92+
ARG JAVA_BINDINGS_MAVEN_VERSION
93+
RUN wget -nv -O /tmp/maven.tar.gz \
94+
https://archive.apache.org/dist/maven/maven-3/${JAVA_BINDINGS_MAVEN_VERSION}/binaries/apache-maven-${JAVA_BINDINGS_MAVEN_VERSION}-bin.tar.gz && \
95+
tar -xzf /tmp/maven.tar.gz -C /opt && \
96+
ln -s /opt/apache-maven-${JAVA_BINDINGS_MAVEN_VERSION} /opt/maven && \
97+
rm /tmp/maven.tar.gz
98+
ENV PATH="/opt/maven/bin:${PATH}"
99+
91100
# Build expects "python" executable (not python3).
92101
RUN rm -f /usr/bin/python && \
93102
ln -s /usr/bin/python3 /usr/bin/python
@@ -121,11 +130,13 @@ RUN cmake -DCMAKE_INSTALL_PREFIX=/workspace/install \
121130
-DTRITON_ENABLE_JAVA_HTTP=ON \
122131
-DTRITON_ENABLE_EXAMPLES=ON -DTRITON_ENABLE_TESTS=ON \
123132
-DTRITON_ENABLE_GPU=${TRITON_ENABLE_GPU} /workspace/client
124-
RUN --mount=type=secret,id=maven_settings,target=/root/.m2/settings.xml,required=false \
133+
RUN --mount=type=secret,id=maven_settings,target=/run/secrets/maven_settings,required=false \
134+
if [ -f /run/secrets/maven_settings ]; then export MAVEN_ARGS="--settings /run/secrets/maven_settings"; fi && \
125135
cmake --build . -v --parallel --target cc-clients java-clients python-clients
126136

127137
# Install Java API Bindings
128-
RUN --mount=type=secret,id=maven_settings,target=/root/.m2/settings.xml,required=false \
138+
RUN --mount=type=secret,id=maven_settings,target=/run/secrets/maven_settings,required=false \
139+
if [ -f /run/secrets/maven_settings ]; then export MAVEN_ARGS="--settings /run/secrets/maven_settings"; fi && \
129140
if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
130141
source /workspace/client/src/java-api-bindings/scripts/install_dependencies_and_build.sh \
131142
--maven-version ${JAVA_BINDINGS_MAVEN_VERSION} \

0 commit comments

Comments
 (0)