eclipse maven depoly项目到nexus
2015-10-21 17:35
666 查看
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>
<url>http://192.168.10.140:8081/nexus/content/repositories/snapshots</url>
</repository>
<repository>
<id>releases</id>
<name>Releases</name>
<url>http://192.168.10.140:8081/nexus/content/repositories/releases</url>
</repository>
<repository>
<id>snapshots-host</id>
<name>SnapshotsHost</name>
<url>http://192.168.10.140:8081/nexus/content/repositories/snapshots-host</url>
</repository>
</repositories>
上面的红色标注地方,为我自定义的一个repository,而我是要往这个repository里面打包,所以必须在settings文件中指定
2、pom.xml配置
<project>节点下添加如下代码,指定要往哪里进行打包,而我这里只需要向releases-host中打包,只写了一个,如果需要多个,可以配置多个:
<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就可以了
<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>
<url>http://192.168.10.140:8081/nexus/content/repositories/snapshots</url>
</repository>
<repository>
<id>releases</id>
<name>Releases</name>
<url>http://192.168.10.140:8081/nexus/content/repositories/releases</url>
</repository>
<repository>
<id>snapshots-host</id>
<name>SnapshotsHost</name>
<url>http://192.168.10.140:8081/nexus/content/repositories/snapshots-host</url>
</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> <url>http://nexus.firewarm.cn:8081/nexus/content/repositories/snapshots-host</url> </repository> <snapshotRepository> <id>snapshots-host</id> <url>http://nexus.firewarm.cn:8081/nexus/content/repositories/snapshots-host</url> </snapshotRepository> </distributionManagement> |
<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就可以了
相关文章推荐
- Java Lock
- JAVA设计模式---原型模式--浅客隆和深克隆
- 实现Java多线程的三种方式
- 用java实现循环链表
- 关于spring和mybatis集成后如何进行批处理总结
- 用java来调用OpenCV (二)
- spring自定义cache
- SpringMVC配置easyui-datagrid
- java建立url请求获取数据
- Java命名规范和代码风格
- Struts2使用ModelDriven
- 用java来调用OpenCV (一)
- 关于Java异常一段很有意思的代码
- 转:visualvm监控远程机器上的Java程序
- springmvc视图解析顺序2
- eclipse性能优化
- OC、C#与JAVA语法特点一些异同(差集&交集)
- Struts中Action的线程访问安全问题
- Struts2常用标签(转载)--【SSH】
- jdk环境变量配置