Issue
I am trying to migrate my builds from Java 8 to Java 11. My repository is located in an S3 bucket. To make S3 wagon working with Java-11 I've added JAXB as a dependency of a plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<dependencies>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
</dependency>
</dependencies>
</plugin>
Unfortunately, it still doesn't help and deploy plugin fails.
Error log fragment (you can see jaxb in the classpath):
Caused by: org.apache.maven.plugin.PluginContainerException: A required class was missing while executing org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file: javax/xml/bind/DatatypeConverter
-----------------------------------------------------
realm = plugin>org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/root/.m2/repository/org/apache/maven/plugins/maven-deploy-plugin/3.0.0-M1/maven-deploy-plugin-3.0.0-M1.jar
urls[1] = file:/root/.m2/repository/jakarta/xml/bind/jakarta.xml.bind-api/2.3.2/jakarta.xml.bind-api-2.3.2.jar
urls[2] = file:/root/.m2/repository/jakarta/activation/jakarta.activation-api/1.2.1/jakarta.activation-api-1.2.1.jar
urls[3] = file:/root/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.2/jaxb-runtime-2.3.2.jar
urls[4] = file:/root/.m2/repository/org/glassfish/jaxb/txw2/2.3.2/txw2-2.3.2.jar
urls[5] = file:/root/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.8/istack-commons-runtime-3.0.8.jar
urls[6] = file:/root/.m2/repository/org/jvnet/staxex/stax-ex/1.8.1/stax-ex-1.8.1.jar
urls[7] = file:/root/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.16/FastInfoset-1.2.16.jar
urls[8] = file:/root/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
urls[9] = file:/root/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
urls[10] = file:/root/.m2/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
urls[11] = file:/root/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
urls[12] = file:/root/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.7.1/plexus-component-annotations-1.7.1.jar
urls[13] = file:/root/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
urls[14] = file:/root/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
urls[15] = file:/root/.m2/repository/org/apache/maven/shared/maven-artifact-transfer/0.10.0/maven-artifact-transfer-0.10.0.jar
urls[16] = file:/root/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/3.0.1/maven-common-artifact-filters-3.0.1.jar
urls[17] = file:/root/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.1.0/maven-shared-utils-3.1.0.jar
urls[18] = file:/root/.m2/repository/commons-codec/commons-codec/1.11/commons-codec-1.11.jar
urls[19] = file:/root/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar
urls[20] = file:/root/.m2/repository/org/codehaus/plexus/plexus-utils/3.1.0/plexus-utils-3.1.0.jar
Anything more missing in the setup?
-edit-
As a solution, I've managed to make it working by moving wagon extension:
<build>
<extensions>
<extension>
<groupId>org.zalando.org.springframework.build</groupId>
<artifactId>aws-maven</artifactId>
<version>5.0.0.RELEASE-zal-2</version>
</extension>
</extensions>
</build>
Into maven-deploy-plugin
dependencies section. But to me it looks like a workaround rather than an answer to the problem.
- edit 2 -
The final solution that works for us is to use S3 wagon extension that is built with newer AWS SDK (picked com.github.nodely:maven-s3-wagon:1.0.0
). Works as desired (adding extension as dependency to plugins was torublesome because it had to be added to any plugin utilizing S3 repository).
Still would be nice to understand original issue and how to apply dependencies to such runtime cases.
Solution
I managed to fix the exactly same issue but with a different implementation of wagon with this extension. It must be version 1.2.0 that support Java 11.
<extension>
<groupId>com.allogy.maven.wagon</groupId>
<artifactId>maven-s3-wagon</artifactId>
<version>1.2.0</version>
</extension>
Answered By - Thiago Leão Moreira
Answer Checked By - Pedro (JavaFixing Volunteer)