Why does our Maven S3 wagon config no longer work?

1.1k Views Asked by At

We have a custom Maven repository hosted with AWS S3. We've been using it for years and haven't had a problem with it until now. My settings are based on our company-internal documentation:

$ cat ~/.m2/settings.xml 

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
        http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <servers>
        <server>
            <id>company-s3-release-repo</id>
            <username>AKxxxxxxxxxxxxxxxx4A</username>
            <password>sFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxRI/8xxS</password>
        </server>
        <server>
            <id>company-s3-snapshot-repo</id>
            <username>AKxxxxxxxxxxxxxxxx4A</username>
            <password>sFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxRI/8xxS</password>
        </server>
    </servers>

    <profiles>
        <profile>
            <id>default</id>
            <repositories>
                <repository>
                    <releases>
                        <updatePolicy>always</updatePolicy>
                        <checksumPolicy>fail</checksumPolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                    <id>company-s3-release-repo</id>
                    <name>company AWS Release Repository</name>
                    <url>s3://maven.company.de/release</url>
                </repository>
                <repository>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <updatePolicy>always</updatePolicy>
                        <checksumPolicy>fail</checksumPolicy>
                    </snapshots>
                    <id>company-s3-snapshot-repo</id>
                    <name>company AWS Snapshot Repository</name>
                    <url>s3://maven.company.de/snapshot</url>
                </repository>
            </repositories>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>default</activeProfile>
    </activeProfiles>
</settings>

The wagon is configured via .mvn/extensions.yml:

$ cat .mvn/extensions.yml

<?xml version="1.0" encoding="UTF-8"?>
<extensions>
    <extension>
        <groupId>org.springframework.build</groupId>
        <artifactId>aws-maven</artifactId>
        <version>5.0.0.RELEASE</version>
    </extension>
</extensions>

Trying to download an artifact from our repo no longer works using mvn -B dependency:get:

$ mvn -B dependency:get -Dtransitive=false -Dartifact=de.company.artifact:artifact:6.0.4
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:get (default-cli) @ standalone-pom ---
[INFO] Resolving de.company.artifact:artifact:jar:6.0.4
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.265 s
[INFO] Finished at: 2021-10-08T09:37:07+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:get (default-cli) on project standalone-pom: Couldn't download artifact: Could not transfer artifact de.company.artifact:artifact:jar:6.0.4 from/to company-s3-release-repo (s3://maven.company.de/release): Cannot access s3://maven.company.de/release with type default using the available connector factories: BasicRepositoryConnectorFactory
[ERROR]   de.company.artifact:artifact:jar:6.0.4
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR]   company-s3-release-repo (s3://maven.company.de/release, releases=true, snapshots=false),
[ERROR]   company-s3-snapshot-repo (s3://maven.company.de/snapshot, releases=false, snapshots=true),
[ERROR]   central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false): Cannot access s3://maven.company.de/release using the registered transporter factories: WagonTransporterFactory: Unsupported transport protocol s3: java.util.NoSuchElementException
[ERROR]       role: org.apache.maven.wagon.Wagon
[ERROR]   roleHint: s3
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

I'm using Maven version 3.8.2:

$ mvn --version
Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f)
Maven home: /usr/local/Cellar/maven/3.8.2/libexec
Java version: 17, vendor: Homebrew, runtime: /usr/local/Cellar/openjdk/17/libexec/openjdk.jdk/Contents/Home
Default locale: en_DE, platform encoding: UTF-8
OS name: "mac os x", version: "11.6", arch: "x86_64", family: "mac"

I tried with alternative wagon configurations in my .mvn/extensions.yml, namely com.allogy.maven.wagon.maven-s3-wagon:1.2.0 as well as org.zalando.org.springframework.build.aws-maven:5.0.0.RELEASE-zal-2. Unfortunately those did not work either with identical error messages.

1

There are 1 best solutions below

0
On

Your .yml file has xml in it.

I added this to the pom.xml and it started working.

   <extensions>
        <extension>
            <groupId>com.github.seahen</groupId>
            <artifactId>maven-s3-wagon</artifactId>
            <version>1.3.3</version>
        </extension>
    </extensions>