eclipse maven depoly项目到nexus

1、setting.xml文件(以下为关键代码):
<servers>
<server>  
  <id>releases</id>  
  <username>admin</username>  
  <password>admin123</password>  
</server>  
<server>  
  <id>snapshots</id>  
  <username>admin</username>  
  <password>admin123</password>  
</server>
<server>  
  <id>thirdparty</id>  
  <username>admin</username>  
  <password>admin123</password>  
</server>
<server>  
  <id>snapshots-host</id>  
  <username>admin</username>  
  <password>admin123</password>  
</server>
</servers> 
...........
<repositories>
  <repository>
   <id>snapshots</id>
   <name>Snapshots</name>
  </repository>
  <repository>
   <id>releases</id>
   <name>Releases</name>
  </repository>
  <repository>
   <id>snapshots-host</id>
   <name>SnapshotsHost</name>
  </repository>
 </repositories>

    上面的红色标注地方,为我自定义的一个 repository ,而我是要往这个 repository里面打包,所以必须在settings文件中指定

2、pom.xml配置
    <project>节点下添加如下代码,指定要往哪里进行打包,而我这里只需要向releases-host中打包,只写了一个,如果需要多个,可以配置多个:
<distributionManagement><!--add by liuyg for deploy project to nexus-->
        <repository>
            <id> snapshots-host </id>
        </repository>
        <snapshotRepository>
            <id> snapshots-host </id>
        </snapshotRepository>
    </distributionManagement>
    < plugins>节点中添加如下代码(用来打包源码):
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

3、eclipse进行deploy到nexus中

然后点击run就可以了
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值