美文网首页
使用脚本上传jar包到mavne远程公共仓储

使用脚本上传jar包到mavne远程公共仓储

作者: 柚子5211 | 来源:发表于2019-03-22 18:24 被阅读0次

    1.首先将Releases仓库默认的Deployment Policy修改为“Allow Redeploy”;


    图片.png

    2.如果是初次使用需要设置密码,然后在右边的Security下面的Users中,修改deployment帐号的密码,方法是在帐号上右键,然后选择“Set Password”


    图片.png

    3.修改Maven settings.xml文件中的server,id应和pom文件中的id对应

    <server>
    <id>wrsnexus</id>
    <username>admin</username>
    <password>111</password>
    </server>


    图片.png

    4.添加pom文件中的远程仓储配置,id应和maven settings.xml文件中的id对应
    <repositories>
    <repository>
    <id>wrsnexus</id>
    <name>3rdparty</name>
    <url>http://ip:8081/nexus/content/groups/public/</url>
    <layout>default</layout>
    <releases>
    <enabled>true</enabled>
    </releases>
    <snapshots>
    <enabled>false</enabled>
    </snapshots>
    </repository>
    </repositories>

    <distributionManagement>
    <repository>
    <id>wrsnexus</id>
    <name>wrsrepository</name>
    <url>http://ip:8081/nexus/content/repositories/wrsrepo</url>
    </repository>
    </distributionManagement>

    图片.png

    5.执行maven脚本上传jar包:
    mvn deploy:deploy-file -Dfile=C:/Users/Qxy123456/Desktop/temporary/chinapaysecure.jar -DgroupId=chinapay -DartifactId=chinapaysecure -Dversion=1.0 -Dpackaging=jar -Durl=http://ip:8081/nexus/content/repositories/thirdparty -DrepositoryId=wrsnexus

    6.本地maven则不需要以上这些配置,直接执行如下命令:
    mvn install:install-file -Dfile=E:/lib/bcmail-jdk13-136.jar -DgroupId=zxbank -DartifactId=bcmail-jdk13-136 -Dversion=1.0 -Dpackaging=Jar

    相关文章

      网友评论

          本文标题:使用脚本上传jar包到mavne远程公共仓储

          本文链接:https://www.haomeiwen.com/subject/smgrvqtx.html