jar包上传至nexus私服

一、将jar包上传至nexus私服

格式:mvn deploy:deploy-file-Durl=file://C:\m2-repo \

                       -DrepositoryId=some.id \

                      -Dfile=your-artifact-1.0.jar \

                       [-DpomFile=your-pom.xml]\

                      [-DgroupId=org.some.group] \

                      [-DartifactId=your-artifact] \

                       [-Dversion=1.0] \

                       [-Dpackaging=jar] \

                       [-Dclassifier=test] \

                       [-DgeneratePom=true] \

                      [-DgeneratePom.description="My Project Description"] \

                      [-DrepositoryLayout=legacy] \

                       [-DuniqueVersion=false]

二、以java_memcached_release.2.6.6.jar为例:

①单个jar上传:

         命令:mvndeploy:deploy-file -Dfile=d:\java_memcached_release_2.6.6.jar -sD:\settings.xml-DgroupId=com.danga -DartifactId =java-memcached -Dversion=2.6.6  -Durl=http://192.168.1.70:8081/nexus/content/repositories/thirdparty/-DrepositoryId=thirdparty

②将javamemcached client的jar包和pom文件一起安装,解决java memcached client对其他jar包的依赖。(主要区别在于DpomFile 的pom文件)

       命令:mvndeploy:deploy-file -Dfile=d:\java_memcached_release_2.6.6.jar  -DpomFile=d:\pom.xml  -sD:\settings.xml -DgroupId=com.danga-DartifactId =java-memcached -Dversion=2.6.6 -Durl=http://192.168.1.70:8081/nexus/content/repositories/thirdparty/-DrepositoryId=thirdparty

pom文件格式:

<?xmlversion="1.0" encoding="UTF-8"?>

<projectxsi:schemaLocation="http://maven.apache.org/POM/4.0.0http://maven.apache.org/xsd/maven-4.0.0.xsd"xmlns="http://maven.apache.org/POM/4.0.0"

   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

 <modelVersion>4.0.0</modelVersion>

 <groupId>com.danga</groupId>

 <artifactId>java-memcached</artifactId>

 <version>2.6.6</version>

 <!-- 配置部署的远程仓库 -->

                   <!--配置部署的远程仓库 -->

                   <distributionManagement>

                   <repository>

                            <id>nexus-releases</id>

                            <name>nexusdistribution releases repository</name>

                            <url>http://192.168.1.70:8081/nexus/content/repositories/releases/</url>

                   </repository>

 

                   <snapshotRepository>

                            <id>nexus-snapshots</id>

                            <name>nexusdistribution snapshot repository</name>

                            <url>http://192.168.1.70:8081/nexus/content/repositories/snapshots/</url>

                   </snapshotRepository>

         </distributionManagement>

<dependencies>

    <dependency>

       <groupId>org.slf4j</groupId>

       <artifactId>slf4j-simple</artifactId>

       <version>1.6.2</version>

   </dependency>

   <dependency>

       <groupId>org.slf4j</groupId>

       <artifactId>slf4j-api</artifactId>

       <version>1.6.2</version>

   </dependency>

   <dependency>

       <groupId>commons-pool</groupId>

       <artifactId>commons-pool</artifactId>

       <version>1.5.6</version>

   </dependency>

</dependencies>

</project>

 

setting.xml文件添加一下配置:

<server>

     <id>nexus-releases</id>

     <username>wwd</username>

     <password>wwd</password>

   </server>

         <server>

     <id>nexus-snapshots</id>

     <username>wwd</username>

     <password>wwd</password>

   </server>

   <server>  

                   <id>thirdparty</id>  

                   <username>wwd</username>  

                   <password>wwd</password>  

         </server>

 

 <mirrors>

   <mirror>

     <id>nexus</id>

     <mirrorOf>*</mirrorOf>

     <name>Human Readable Name for this Mirror.</name>

     <url>http://192.168.1.70:8081/nexus/content/groups/seGroup/</url>

   </mirror>

 </mirrors>

 

 <profiles>

   <profile>

     <id>central-repos</id>

 

     <repositories>

        <repository>

         <id>central</id>

         <name>Central</name>

         <url>http://192.168.1.70:8081/nexus/content/repositories/central/</url>

          <releases>

                            <enable>true</enable>

                     </releases>

                     <snapshots>

                            <enabled>true</enabled>

                     </snapshots>

       </repository>

     </repositories>

   </profile>

 </profiles>

 

 <activeProfiles>

         <activeProfile>central-repos</activeProfile>

 </activeProfiles>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值