我们有一个由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>
使用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
。不幸的是,这些配置也不起作用,错误信息相同。
1条答案
按热度按时间wnavrhmk1#
您的.yml文件中包含xml。
我把它添加到pom.xml中,它就开始工作了。