电脑,用来验证刚刚部署的Nexus3可以缓存中央仓库的jar包(您也可以用虚拟机创建两台电脑); A、B两台电脑都已经装好了JDK8和Maven3; 如下图,在仓库列表页面,点击下图红框位置,可以得到maven-central 仓库的地址http://192.168.50.75:8081/repository/maven-central/: ? 修改两台电脑的maven配置文件 电脑A和电脑B上的maven目录下的conf/settings.xml文件都要做以下修改: 找到servers节点,增加以下内容: <server> <id>maven-central 仓库地址: <mirror> <id>maven-central</id> <mirrorOf>*</mirrorOf> <url>http://192.168.50.75:8081/repository /maven-central/</url> </mirror> 在A电脑上编译构建项目(应该很慢) 在A电脑上编译开源项目spring-cloud-alibaba,此时Nexus上没有缓存任何jar包,
proxy 某个远程仓库的代理 group 存放:通过 Nexus 获取的第三方 jar 包 hosted 存放:本团队其他开发人员部署到 Nexus 的 jar 包 3、仓库名称&说明 仓库名称 说明 maven-central Downloaded from zibo-nexus-maven: http://localhost:8081/repository/maven-central/org/codehaus/plexus/ junit/junit/3.8.2/junit-3.8.2.jar Downloaded from zibo-nexus-maven: http://localhost:8081/repository/maven-central log4j-1.2.12.jar (358 kB at 63 kB/s) Downloaded from zibo-nexus-maven: http://localhost:8081/repository/maven-central junit-3.8.2.jar (121 kB at 21 kB/s) Downloaded from zibo-nexus-maven: http://localhost:8081/repository/maven-central
文件中配置私服的地址即可,配置如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 <repositories> <repository> <id>maven-central </id> <name>maven-central</name> <url>http://10.0.1.42:8081/repository/maven-central
6.本地仓库地址: http://127.0.0.1:8081/repository/maven-public/ http://127.0.0.1:8081/repository/maven-central <id>nexus central</id> <name>LAN nexus central</name> <url>http://127.0.0.1:8081/repository/maven-central
updatePolicy> </snapshots> </repository> </repositories> </profile> <profile> <id>maven-central </id> <repositories> <repository> <id>maven-central</id> <url>https://central.maven.org > </profiles> <activeProfiles> <activeProfile>aliyun</activeProfile> <activeProfile>maven-central
两台电脑都已经装好了JDK8和Maven3; A、B两台电脑上的maven目录下的conf/settings.xml文件都要做以下修改; 找到servers节点,增加以下内容: <server> <id>maven-central >bolingcavalry</username> <password>123456</password> </server> 找到mirrors节点,增加以下内容,其中url的内容就是前面得到的maven-central 仓库地址: <mirror> <id>maven-central</id> <mirrorOf>*</mirrorOf> <url>http://192.168.50.42:8081/repository /maven-central/</url> </mirror> 在A电脑上编译构建项目(应该很慢) 在A电脑上编译开源项目spring-cloud-alibaba,此时Nexus上没有缓存任何jar包,
</snapshots> </repository> </repositories> </profile> <profile> <id>maven-central </id> <repositories> <repository> <id>maven-central</id> <url>http activeProfile>boundlessgeo</activeProfile> <activeProfile>aliyun</activeProfile> <activeProfile>maven-central
默认仓库说明 maven-central:maven中央库,默认从repo1.maven.org/maven2/拉取ja… maven-releases:私库发行版jar,初次安装请将Deployment central.maven.org http://central.maven.org/maven2/ 6. datanucleus http://www.datanucleus.org/downloads/maven2 7. maven-central </releases> </repository> <repository> <id>maven-central <name>Central Repositories</name> <url>http://localhost:8082/repository/maven-central
4.3 配置代理仓库Nexus默认使用的远程仓库为maven-central,从这个远程仓库下载依赖很慢,经常连不上,如图10所示。 鼠标单机maven-central仓库,查看maven-central仓库配置的远程链接,如图11所示。 可以看到,maven-central仓库配置的远程链接为https://repo1.maven.org/maven2/,从这个远程仓库下载依赖很慢,经常连不上,所有我们需要配置远程代理仓库。 4.4 配置仓库组接下来,需要将aliyun-central配置到仓库组,并且将aliyun-central排在maven-central上面。具体步骤如下所示。
在Repositories 仓库管理界面中有多种默认的仓库,也可以添加新的仓库,本实例直接使用默认的仓库: maven-central,Type为proxy,表示代理仓库。 代理仓库用来代理远程仓库(maven-central代理的是超级POM中配置的Maven中央仓库),当在下载组件时,如果代理仓库搜索不到,则会把请求转发到远程仓库从远程仓库下载。 mirror> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://localhost:8081/repository/maven-central
[ext], bootOnly maven-central 重新打包 rm ./sbt-launch.jar # 删除旧的 jar -cfM ./sbt-launch.jar .
https://img.shields.io/maven-central/v/io.github.vampireachao/stream-query?
4.3 配置阿里云代理仓库 Nexus默认使用的远程仓库为maven-central,从这个远程仓库下载依赖很慢,经常连不上,如图10所示。 鼠标单机maven-central仓库,查看maven-central仓库配置的远程链接,如图11所示。 可以看到,maven-central仓库配置的远程链接为https://repo1.maven.org/maven2/,从这个远程仓库下载依赖很慢,经常连不上,所有我们需要配置阿里云远程代理仓库。 4.4 配置仓库组 接下来,需要将aliyun-central配置到仓库组,并且将aliyun-central排在maven-central上面。具体步骤如下所示。
mirrorOf>central</mirrorOf> <name>sjtug maven</name> <url>https://mirrors.sjtug.sjtu.edu.cn/maven-central
groups/public/ Nexus osc thirdparty : http://maven.oschina.net/content/repositories/thirdparty/ maven-central
[ext], bootOnly sonatype-oss-releases maven-central sonatype-oss-snapshots 保存即可 另外有时候输入sbt的时候会提示一个
maven-central proxy类型。maven中央库,默认从https://repo1.maven.org/maven2/拉取jar。 maven-releases hosted类型。
设置 系统默认只带maven-central、maven-public、maven-releases、maven-snapshots 4个仓库,可以直接使用,当然也可以创建自己的仓库,点击 点击创建仓储按钮
By default, the repository manager ships with the following configured proxy repositories: maven-central
接下来,话不多说,开始动手实操了 安装 windos平台 下载地址:maven-central v3.0.5 https://img.shields.io/maven-central/v/com.taobao.arthas