maven 无法将 jar 文件传输到 nexus 存储库

maven Failed to transfer jar file to nexus repository

我在 Nginx 反向代理后面的服务器上安装了一个 nexus。我创建了 maven-snapshotsmaven-releases 存储库。两个存储库都允许重新部署。 maven-snapshots 的版本策略是 Snapshotmaven-releases 的版本策略是 Release 我还创建了一个具有 nx-repository-view-*-*-* 特权的角色和一个具有该给定角色的用户 nx-dev。 在我的 Maven 设置中:

<server>
  <id>nexus-snapshots</id>
  <username>nx-dev</username>
  <password>NX-DEV-PASSWORD</password>
</server>

<server>
  <id>nexus-releases</id>
  <username>nx-dev</username>
  <password>NX-DEV-PASSWORD</password>
</server>

在我的项目 POM 文件中:

<distributionManagement>
    <snapshotRepository>
        <id>nexus-snapshots</id>
        <url>https://nexus.mysite.com/repository/maven-snapshots/</url>
    </snapshotRepository>
    <repository>
        <id>nexus-releases</id>
        <url>https://nexus.mysite.com/repository/maven-releases/</url>
    </repository>
</distributionManagement>

当我 运行 mvn -X deploy 命令时,我得到这个错误:

Failed to transfer file https://nexus.mysite.com/repository/maven-releases/com/myapp/my-app/0.0.3/myapp-0.0.3.jar  with status code 400

jar 文件大小为 47MB,远小于 Nginx 允许的 1G:

client_max_body_size 1G;

当我浏览我的存储库时,我可以看到 .pom.pom.md5.pom.sha1 文件,但没有上传 jar 文件。有什么想法吗?

编辑:

在 Nexus 日志中,我看到这个警告:

2020-11-16 10:00:59,843+0000 WARN  [qtp1621258076-423]  
nx-payware org.sonatype.nexus.repository.view.handlers.ExceptionHandler - Invalid content: 
PUT /com/myapp/my-app/0.0.3-SNAPSHOT/my-app-0.0.3-20201116.095741-1.jar: 
org.sonatype.nexus.repository.InvalidContentException: 
Detected content type [application/x-sh], but expected [application/java-archive]: 
/com/myapp/my-app/0.0.3-SNAPSHOT/my-app-0.0.3-20201116.095741-1.jar

Spring 引导可执行 jar 文件被检测为 shell 脚本。为了解决这个问题,禁用托管存储库中的文件内容验证。

取消选中严格内容类型验证: