网上的帖子大部分都是可以的,在这我就不用描述了,但是在没有网络的情况下先把仓库给下载完全的帖子网上是没有的。
1.修改pom.xml 这个我就不用说了这个也是可以的,但是 和maven 有关的插件不是通过 nexus 仓库管理的。
2.修改 setting.xml 这是个好办法,这样你仓库的插件还是 jar包都是通过 nexus 来管理的,只要你下载一便,在没有网路的情况下也是可以使用的
在 setting.xml 的profiles 节点下添加一下内容,url 修改为你nexus 仓库的地址
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<layout>default</layout>
<url>http://localhost:8888/nexus/content/repositories/central/</url>
<releases><enabled>true</enabled> </releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://localhost:8888/nexus/content/repositories/central/</url>
<releases><enabled>true</enabled> </releases>
<snapshots><enabled>false</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
注意以上 <id>nexus</id> 这句话很重要,下面还要用到,名称你可以随便起
找到setting.xml 的末尾添加,默认是有这个标签的只是注释了,这里面的id 就是你 profile 标签的id
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>