maven 仓库搭建
搭建
采用docker镜像,一步完成
docker run -d -p 8081:8081 --name nexus sonatype/nexus:oss
见:https://registry.hub.docker.com/u/sonatype/nexus/
访问:http:127.0.0.1:8081 用户名密码:admin/admin123
配置
在users 禁用anyons,修改dev,admin密码即可。别的只做读取的话可以不配
需要上传配置见:http://blog.csdn.net/ichsonx/article/details/14642897 没测试。。。
eclipse 配置
你打开eclipse的 preferences -> maven -> User Settings 你就可以看到你的setting.xml文件的地址了。
然后将setting.xml文件打开。修改里面的mirror节点 。url指向远程仓库的地址。 这样设置之后你的所有项目都有作用。
下面的配置文件记得改用户名密码和仓库url,别的不用改。。
<?xml version="1.0" encoding="UTF-8"?>
<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">
<pluginGroups></pluginGroups>
<proxies></proxies>
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://127.0.0.1:8081/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>