如何让本地的项目访问我们的私服
2016-04-25 00:14
232 查看
b本地项目区下载架包的时候,顺序是:本地的仓库存储文件夹→本地私服(nexus)→中央仓库
我们可以在maven中的settings.xml中这样设置
而且我们要设置一个镜像,使得,无论下载什么类型的架包,都会通过这个镜像来去我们本地私服去下载,如果下载不到的话,私服会自动的去中央仓库去下载
我们可以在maven中的settings.xml中这样设置
<profiles> <!--配置我们自己的工厂--> <profile> <id>nexusProfile</id> <repositories> <repository> <id>test</id> <name>nexus</name> <url>http://localhost:8081/nexus/content/groups/public/</url> <!-- 可以下载releases的架包,默认是打开的 --> <releases> <enabled>true</enabled> </releases> <!-- 可以下载snapshots的架包,默认是关闭的 --> <snapshots> <enabled> true </enabled> </snapshots> </repository> </repositories> </profile> <!--这边重写了central的信息--> <profile> <id>mycentral</id> <repositories> <repository> <id>central</id> <name>Central Repository</name> <url>http://rep</url> <layout>default</layout> <snapshots> <!--原本默认是为false。现在修改成了true,架包中的配置就无效了@--> <enabled>true</enabled> </snapshots> </repository> </repositories> </profile> </profiles> <!--进行激活上面的profile--> <activeProfiles> <activeProfile>mycentral</activeProfile> </activeProfiles>
而且我们要设置一个镜像,使得,无论下载什么类型的架包,都会通过这个镜像来去我们本地私服去下载,如果下载不到的话,私服会自动的去中央仓库去下载
<mirrors> <!-- mirror | Specifies a repository mirror site to use instead of a given repository. The repository that | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used | for inheritance and direct lookup purposes, and must be unique across the set of mirrors. | <mirror> <id>mirrorId</id> <mirrorOf>repositoryId</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://my.repository.com/repo/path</url> </mirror> --> <!--工厂的镜像,只要mirrorof中的工厂要访问,就会自动来找镜像,如果镜像无法的访问就不会去中央工厂去下载了--> <mirror> <id>nexusMirror</id> <!--使用*表示,所有的都来这边访问,这样的话就可以去掉activeProfiles了--> <mirrorOf>*</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://localhost:8081/nexus/content/groups/public/</url> </mirror> </mirrors>
相关文章推荐
- Flask系列----快速入门实战解析(上篇)
- 《机器学习实战》Logistic回归算法(1)
- 雷军:风口论一直被误读 我不是机会主义者
- iOS开发需要哪些图片?
- linux下maven的安装配置
- runtime详解
- iOS开发系列--无限循环的图片浏览器
- 经典软件体系结构风格——仓库风格
- java基础(24)--java.util.Properties类
- c++作业4
- 排序算法-桶排序
- 10个常用Linux系统ps命令实战
- ARM开发板连接外网
- VirtualBox Host-only Adapter,Failed to create the host-only adapter
- PHP Startup redis: Unable to initialize module
- Android 常用工具类之 DimenUtil
- list.index()
- tomcat与http协议,servlet整合
- list.insert()
- list.reverse()