• 如何把jar包发布到maven私服


    1.格式

     mvn deploy:deploy-file -DgroupId=com.qiyi -DartifactId=sphinx -Dversion=1.0 -Dpackaging=jar -Dfile=D:sphinxapi.jar -Durl=[url] -DrepositoryId=[id

    2.实例

    D:developapache-maven-3.0.4in>mvn deploy:deploy-file -DgroupId=org.sphx -DartifactId=sphinxapi -Dversion=1.0 -Dpackaging=jar -Dfile=D:sphinxapi.jar

    -Durl=http://10.10.10.10:8800/nexus/content/repositories/thirdparty/ -DrepositoryId=thirdparty

    DgroupId和DartifactId构成了该jar包在pom.xml的坐标,项目就是依靠这两个属性定位。自己起名字也行。

    Dfile表示需要上传的jar包的绝对路径。

    Durl私服上仓库的位置,打开nexus——>repositories菜单,可以看到该路径。

    DrepositoryId服务器的表示id,在nexus的configuration可以看到。

    上传成功后,在nexus界面点击3rd party仓库可以看到这包。

    3.配置权限

    $MAVEN/conf/settings.xml

    <servers>
    <!-- server
    | Specifies the authentication information to use when connecting to a particular server, identified by
    | a unique name within the system (referred to by the 'id' attribute below).
    |
    | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
    | used together.
    |
    -->
    <server>
    <id>releases</id>
    <username>admin</username>
    <password>admin123</password>
    </server>
    <!-- Another sample, using keys to authenticate.
    <server>
    <id>siteServer</id>
    <privateKey>/path/to/private/key</privateKey>
    <passphrase>optional; leave empty if not used.</passphrase>
    </server>
    -->
    </servers>

     以下为自己测试过

    mvn deploy:deploy-file -DgroupId=com.lc.components -DartifactId=lc-components -Dversion=0.0.1 -Dpackaging=jar -Dfile=/Users/ckr/Desktop/lc-commons-0.0.1.jar -Durl=http://192.168.1.121:8081/repository/lc-hosted -DrepositoryId=nexus

    mvn deploy:deploy-file -DgroupId=ccom.aliyun.alicom -DartifactId=alicom-mns-receive-sdk  -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar -Dfile=/Users/ckr/Desktop/alicom-mns-receive-sdk-0.0.1-SNAPSHOT.jar -Durl=http://192.168.1.121:8081/repository/maven-snapshots 
     
     本地环境安装:

    mvn install:install-file -Dfile=D:/soft/taobao-sdk/taobao-sdk-java-auto_1535979857702-20190712.jar -DgroupId=com.taobao -DartifactId=taobao-sdk-java-auto_1535979857702-20190712 -Dversion=20190712 -Dpackaging=jar

    mvn install:install-file -Dfile=D:/soft/taobao-sdk/taobao-sdk-java-auto_1535979857702-20190712-source.jar -DgroupId=com.taobao -DartifactId=taobao-sdk-java-auto_1535979857702-20190712-source -Dversion=20190712 -Dpackaging=jar

    上传到远程私服:

    mvn deploy:deploy-file -DgroupId=com.taobao -DartifactId=taobao-sdk-java-auto_1535979857702-20190712-source -Dversion=20190712 -Dpackaging=jar -Dfile=D:/soft/taobao-sdk/taobao-sdk-java-auto_1535979857702-20190712-source.jar -Durl=http://122.224.191.90:8081/repository/maven-releases/ -DrepositoryId=releases

    mvn deploy:deploy-file -Dfile=D:/soft/taobao-sdk/taobao-sdk-java-auto_1535979857702-20190712.jar -DgroupId=com.taobao -DartifactId=taobao-sdk-java-auto_1535979857702-20190712 -Dversion=20190712 -Dpackaging=jar -Durl=http://122.224.191.90:8081/repository/maven-releases/ -DrepositoryId=releases

  • 相关阅读:
    洛谷1076 寻宝
    洛谷1349 广义斐波那契数列 【矩阵乘法】
    BZOJ1008 [HNOI2008]越狱
    vijosP1629 八
    vijosP1687 细菌总数
    vijosP1388 二叉树数
    怎么在windows上安装 ansible How to install ansible to my python at Windows
    阿里邮箱绑定Foxmail失败的解决办法
    Django html页面 'ascii' codec can't encode characters in position 8-10: ordinal not
    python2.X现在不能安装Django了:Collecting django Using cached Django-2.0.tar.gz
  • 原文地址:https://www.cnblogs.com/justuntil/p/7133730.html
Copyright © 2020-2023  润新知