Fix Docker build due to missing json-smart version

Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.8.1:go-offline (default-cli) on project war: org.eclipse.aether.resolution.DependencyResolutionException: Failed to collect dependencies at org.springframework.boot:spring-boot-starter-oauth2-client:jar:3.4.1 -> org.springframework.security:spring-security-oauth2-client:jar:6.4.2 -> com.nimbusds:oauth2-oidc-sdk:jar:9.43.4 -> net.minidev:json-smart:jar:[1.3.3,2.4.10]: No versions available for net.minidev:json-smart:jar:[1.3.3,2.4.10] within specified range

With the release 2.5.2 of net.minidev:json-smart the Maven metadata at https://repo1.maven.org/maven2/net/minidev/json-smart/maven-metadata.xml only include the absolute newest version. Compare with the old cached version at https://web.archive.org/web/20240212064759if_/https://repo.maven.apache.org/maven2/net/minidev/json-smart/maven-metadata.xml. This causes issues for Maven's dependency plugin go-offline goal which, for some reason, ignores any dependency version upgrades in <dependencyManagement> and only checks for what's written in the pom.xml of com.nimbus:oauth2-oidc-sdk:9.43.4. Since that pom file requires a version in the  range of 1.3.3 to 2.4.10 none of which are no longer available in the Maven metadata file the goal will fail.

This change removes the dependency caching layer from the Docker build to get around this problem for now. It will slow down Docker builds, but it is what it is.

References:
* https://github.com/netplex/json-smart-v2/issues/240
* https://repo1.maven.org/maven2/net/minidev/json-smart/maven-metadata.xml
* https://web.archive.org/web/20240212064759if_/https://repo.maven.apache.org/maven2/net/minidev/json-smart/maven-metadata.xml
* https://repo1.maven.org/maven2/com/nimbusds/oauth2-oidc-sdk/9.43.4/oauth2-oidc-sdk-9.43.4.pom
This commit is contained in:
Andreas Svanberg 2025-02-12 13:09:06 +01:00
parent 304d0431c1
commit f2aef34f5a
2 changed files with 0 additions and 48 deletions

@ -13,12 +13,6 @@ COPY view/pom.xml view/pom.xml
COPY war/pom.xml war/pom.xml
COPY daisy-integration/pom.xml daisy-integration/pom.xml
# Download dependencies in a separate layer to allow caching for future builds
RUN ./mvnw dependency:go-offline \
--batch-mode \
--define includeScope=compile \
--activate-profiles docker-dependencies
COPY api/src/ api/src/
COPY core/src/ core/src/
COPY view/src/ view/src/
@ -26,7 +20,6 @@ COPY war/src/ war/src/
COPY daisy-integration/src/ daisy-integration/src/
RUN ./mvnw package \
--offline \
--define skipTests \
--activate-profiles branch,DEV \
--define skip.npm \

@ -140,46 +140,5 @@
<spring.profile.active>branch</spring.profile.active>
</properties>
</profile>
<profile>
<id>docker-dependencies</id>
<!--
Some dependencies are not discovered by default when running dependency:go-offline.
They are added here manually to allow Docker build layers to be cached properly.
-->
<dependencies>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml</groupId>
<artifactId>classmate</artifactId>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
<classifier>jakarta</classifier>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>