You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

部署至Maven Central时遇“Bundle无.pom文件”错误求助

解决Maven Central上传报错“Bundle has content that does NOT have a .pom file”
  • 检查Maven部署插件配置
    确保maven-deploy-plugin或nexus-staging-maven-plugin的配置没忽略pom的生成和上传。比如nexus-staging-maven-plugin用默认配置即可,不要覆盖导致排除pom:

    <plugin>
      <groupId>org.sonatype.plugins</groupId>
      <artifactId>nexus-staging-maven-plugin</artifactId>
      <version>1.6.13</version>
      <extensions>true</extensions>
      <configuration>
        <serverId>ossrh</serverId>
        <nexusUrl>https://oss.sonatype.org/</nexusUrl>
        <autoReleaseAfterClose>true</autoReleaseAfterClose>
      </configuration>
    </plugin>
    

    同时确认maven-install-plugin正常执行,它负责把pom安装到本地仓库,是后续上传的基础。

  • 验证打包产物里的pom文件
    执行mvn clean package后,去target目录找{artifactId}-{version}.pom文件。如果没有,检查pom.xml里是不是有自定义打包配置漏了生成pom的步骤。

  • 检查Staging仓库的内容
    登录Sonatype后台,打开对应的Staging Repository,看看上传的bundle里有没有pom文件。如果确实没传上去,别手动单独传jar,直接重新跑mvn clean deploy——Maven插件会自动把pom、jar、源码、javadoc这些关联好一起上传。

  • 确认GPG签名配置
    Maven Central要求*所有构件(包括pom)*都要有GPG签名。要是pom没签名,也会被判定为无效。检查maven-gpg-plugin的配置,确保它对pom执行签名:

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-gpg-plugin</artifactId>
      <version>3.0.1</version>
      <executions>
        <execution>
          <id>sign-artifacts</id>
          <phase>verify</phase>
          <goals>
            <goal>sign</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
    
  • 排查项目模块结构问题
    要是是多模块项目,得确保父、子模块的pom配置没问题,子模块部署时不会漏传pom。执行mvn clean deploy -DskipTests,确认所有模块的pom都被正确生成和上传。

内容的提问来源于stack exchange,提问作者ple Lee

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 11:21:17