【问题标题】:Maven fails to publish artifact to AWS S3Maven 无法将工件发布到 AWS S3
【发布时间】:2021-09-08 07:29:45
【问题描述】:

我正在尝试通过 gitlab CI 管道将 jar 上传到 S3。 在deploy 舞台上,使用脚本运行作业。

- mvn -s ../aws-settings.xml deploy

我的aws-settings.xml 文件看起来像这样(AWS 访问密钥在 gitlab CI 中设置为环境变量)

<settings>
    <servers>
        <server>
            <id>artifact-s3-repo</id>
            <username>${env.AWS_ACCESS_KEY_ID}</username>
            <password>${env.AWS_SECRET_ACCESS_KEY}</password>
            <configuration>
                <region>${env.AWS_DEFAULT_REGION}</region>
            </configuration>
        </server>
    </servers>
</settings>

在我的pom.xml 中,我将分发管理设置为

    <distributionManagement>
        <repository>
            <id>artifact-s3-repo</id>
            <url>s3://<myartifactbucketname>/</url>
        </repository>
    </distributionManagement>

我的管道在 deploy 阶段失败,输出如下

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project <my-project-name>: Failed to deploy artifacts/metadata: Cannot access s3://<myartifactbucketname>/ with type default using the available connector factories: BasicRepositoryConnectorFactory: Cannot access s3://<myartifactbucketname>/ using the registered transporter factories: WagonTransporterFactory: java.util.NoSuchElementException

我需要一些提示来正确配置与 aws 的连接(如果可能,无需添加其他插件)。提前谢谢你。

【问题讨论】:

    标签: maven amazon-s3 wagon


    【解决方案1】:

    我没有设法通过 maven deploy 将工件发布到 S3,但我在管道脚本中实现了 AWS CLI 命令

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-27
      • 2016-05-30
      • 2018-09-25
      • 1970-01-01
      • 2022-12-20
      • 1970-01-01
      • 2016-05-07
      • 2012-02-29
      相关资源
      最近更新 更多