【问题标题】:Cant upload shaded jar to nexus无法将阴影 jar 上传到 nexus
【发布时间】:2019-09-29 01:08:09
【问题描述】:

我正在尝试使用 Gitlab-Ci 将 maven 项目部署到我们的 Nexus,但在尝试上传由 maven-shade-plugin 创建的 shaded-jar 时,管道总是失败。任何想法为什么会这样?

管道错误:

[INFO] Uploading to pp-snapshots: https://nexus.myplayplanet.net/repository/myplayplanet-snapshots/net/myplayplanet/MyPlayPlanet-Core/1.14.0-SNAPSHOT/MyPlayPlanet-Core-1.14.0-20190929.002150-7-shaded.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:53 min
[INFO] Finished at: 2019-09-29T00:21:51Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project MyPlayPlanet-Core: Failed to deploy artifacts: Could not transfer artifact net.myplayplanet:MyPlayPlanet-Core:jar:shaded:1.14.0-20190929.002150-7 from/to pp-snapshots (https://nexus.myplayplanet.net/repository/myplayplanet-snapshots/): Connection reset by peer (Write failed) -> [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

shade-plugin 配置:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.2.1</version>
    <configuration>
        <shadedArtifactAttached>true</shadedArtifactAttached>
        <filters>
            <filter>
                <artifact>*:*</artifact>
                <excludes>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                </excludes>
            </filter>
        </filters>
    </configuration>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
        </execution>
    </executions>
</plugin>

【问题讨论】:

    标签: maven nexus


    【解决方案1】:

    看起来我使用了错误的 maven 图像。 我刚刚使用了 maven:latest,但是当我将其更改为 maven:3.6.2-jdk-8 时,它又可以工作了。

    【讨论】:

    • 有趣。赞成。 Docker maven 最新 (hub.docker.com/_/maven) 是 3.6.2-jdk-11,所以,正如我在答案中提到的,可能存在 TLS 问题。
    【解决方案2】:

    错误是:

    Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) 
      on project MyPlayPlanet-Core: 
    
    Failed to deploy artifacts: 
    
    Could not transfer artifact net.myplayplanet:MyPlayPlanet-Core:jar:shaded:1.14.0-20190929.002150-7 
    from/to pp-snapshots (https://nexus.myplayplanet.net/repository/myplayplanet-snapshots/)
    
    Connection reset by peer (Write failed)
    

    检查快照工件的大小,可能存在大小限制问题。

    还要检查您在本地使用的 JDK 版本,如 this issue

    通过以下方式禁用 TLS 1.3 协议:

    -Djdk.tls.client.protocols="TLSv1,TLSv1.1,TLSv1.2"
    

    【讨论】:

      猜你喜欢
      • 2013-05-31
      • 2015-07-26
      • 2016-11-30
      • 2021-02-27
      • 2018-05-03
      • 2012-03-05
      • 1970-01-01
      • 1970-01-01
      • 2019-03-27
      相关资源
      最近更新 更多