maven 向私服部署jar

1.有源码的情况下

首先需要在要deploy的项目pom中添加私服地址

<distributionManagement>
        <repository>
            <id>nexus-xxxx-release</id>
            <url>
                http://ip/repository/xxxx-repo-release/
            </url>
        </repository>
        <snapshotRepository>
            <id>nexus-xxxx-snapshot</id>
            <url>
                http://ip/repository/xxxx-repo-snapshot/
            </url>
        </snapshotRepository>
    </distributionManagement>

私服一般都是需要用户名/密码认证才能部署jar的,需要在setting.xml中添加 私服用户名和密码

<servers>
<server>
      <id>nexus-abcdw-snapshot</id>
      <username>abcdw-cc-snapshot</username>
      <password>abcdw123</password>
    </server>
   <server>
      <id>nexus-abcdw-release</id>
      <username>abcdw-cc-release</username>
      <password>abcdw123</password>
    </server>
    </servers>

然后 mvn clean deploy 就可以了

 

2.直接部署第三方jar包

经测试,不能从本地仓库部署,要把jar包copy 到仓库外面再执行以下命令

mvn deploy:deploy-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -Dfile=ojdbc6-11.2.0.3.jar -Durl=http://host/repository/haha-repo-release/ -DrepositoryId=nexus-haha-release

 

3.向本地maven repository install jar 包

mvn install:install-file "-DgroupId=auth-tools" "-DartifactId=auth-tools" "-Dversion=1.0-SNAPSHOT" "-Dpackaging=jar" "-Dfile=auth-tools-1.0-SNAPSHOT.jar"

 

posted @ 2018-10-11 21:36  生心无住  阅读(938)  评论(0编辑  收藏  举报