1

我们有一个使用 AWS S3 托管的自定义 Maven 存储库。我们已经使用了多年,直到现在还没有遇到过问题。我的设置基于我们公司的内部文档:

$ 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>

货车通过以下方式配置.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>

尝试从我们的 repo 下载工件不再有效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

我正在使用 Maven 版本 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"

我尝试了在我的替代旅行车配置.mvn/extensions.yml,即com.allogy.maven.wagon.maven-s3-wagon:1.2.0以及org.zalando.org.springframework.build.aws-maven:5.0.0.RELEASE-zal-2。不幸的是,那些也没有与相同的错误消息一起工作。

4

0 回答 0