網上的文章大部分都是可以的,在這我就不用描述了,但是在沒有網絡的情況下先把倉庫給下載下傳完全的文章網上是沒有的。
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>