nexus maven私有库搭建

1.下载nexus包,linux命令
wget http://sonatype-download.global.ssl.fastly.NET/nexus/oss/nexus-2.11.4-01-bundle.tar.gz
2.解压nexus包
tar -zxvf nexus-2.11.4-01-bundle.tar.gz
3.配置环境变量
export RUN_AS_USER=root
4.启动命令(start | stop | restart),前提是配置了Java环境,默认端口为8081
./nexus-2.11.4-01/bin/nexus start
5.可以修改自己默认端口(nexus-2.11.4-01/conf/nexus.properties)
6.登录界面:http://IP:8081/nexus
[img]http://dl2.iteye.com/upload/attachment/0121/9192/a7b08945-c5b9-3799-b870-ff1a8c71975d.jpg[/img]
其中默认用户/密码:admin/admin123
登录后的界面
[img]http://dl2.iteye.com/upload/attachment/0121/9196/e3890e78-56ba-3c23-8295-5f55b9aa5411.jpg[/img]
7.配置本地maven的setting配置

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository

-->
<localRepository>D:/MvnRepository</localRepository>
<servers>
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<name>internal nexus repository</name>
<url>http://192.168.149.192:8081/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<name>Nexus</name>
<url>http://192.168.149.192:8081/nexus/content/groups/public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus</name>
<url>http://192.168.149.192:8081/nexus/content/groups/public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Releases Repository</name>
<url>http://192.168.149.192:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshots Repository</name>
<url>http://192.168.149.192:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>

<activeProfiles>
<!-- 激活nexusRepo这个profile:只有激活才生效 -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>

8.pom.xml文件配置:上传私有库代码

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.1</version>
<configuration>
<attach>true</attach>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://192.168.149.192:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://192.168.149.192:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>

基本配置已完成;
具体详情可参考博客:
[url]http://blog.youkuaiyun.com/shenshen123jun/article/details/9084293[/url]
[url]http://www.cnblogs.com/luotaoyeah/p/3791966.html[/url]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值