jar包上传到nexus私有仓库后pom文件内的依赖丢失

368 阅读1分钟

今天将jar包通过nexus自带的上传页面后发现,项目无法启动,idea在maven工具栏发下jar包内的依赖并没有加载,直接点击版本号可以发现打开的pom文件除了自带的artifactgroupId之类的信息外一片空白,查询后发现nexus自动生成的pom文件就是这个死样子,没办法只能转命令上传 先要在mevensetting.xml中配置下账号信息

<servers>
    <server>
      <id>thirdparty</id>
      <username>xxx</username>
      <password>xxxxx</password>
    </server>
  </servers>

mvn脚本如下

mvn deploy:deploy-file -Dfile=xx-xx-xx-3.4.0.jar -DpomFile=xx-xx-xx-3.4.0.pom -Dpackaging=jar -Durl=https://nexus.xxx.xxx/nexus/content/repositories/thirdparty -DrepositoryId=thirdparty -DgroupId=com.github.binarywang -DartifactId=weixin-java-miniapp -Dversion=3.4.0 -Dpackaging=jar

这里的pom可以先本地install了生成后,从本地仓库中把jarpom都拷出来放在一个文件夹中即可,我本地的maven无法在本地仓库中直接上传会报错

Cannot deploy artifact from the local repository