1、maven设置本地仓库使得可以从本地仓库nexus里面下载jar包,提高效率
2、选择maven的安装用户,如果是使用root安装的,就到/root/.m2目录下创建settings.xml文件
cd /root/.m2
touch settings.xml
3、把本地的仓库地址配置进去settings.xml
<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">
<localRepository>/root/.m2/repository</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
<server>
<id>releases</id>
<username>admin</username>
<password>ichoice@123</password>
</server>
<server>
<id>Snapshots</id>
<username>admin</username>
<password>123</password>
</server>
<server>
<id>third</id>
<username>admin</username>
<password>123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus-all</id>
<url>http://192.168.1.209:9081/repository/maven-public/</url>
<mirrorOf>*</mirrorOf>
</mirror>
<mirror>
<id>nexus-snapshots</id>
<url>http://192.168.1.209:9081/repository/maven-public/</url>
<mirrorOf>public-snapshots</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<name>Nexus</name>
<url>http://192.168.1.209:9081/repository/maven-public</url>
<release><enabled>true</enabled></release>
<snapshots><enabled>true></enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus</name>
<url>http://192.168.1.209:9081/repository/maven-public</url>
<release><enabled>true</enabled></release>
<snapshots><enabled>true></enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>public-snapshots</id>
<repositories>
<repository>
<id>public-snapshots</id>
<url>http://192.168.1.209:9081/repository/maven-snapshots</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public-snapshots</id>
<url>http://192.168.1.209:9081/repository/maven-snapshots</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
<activeProfile>public-snapshots</activeProfile>
</activeProfiles>
</settings>
4、这个设置是下载到本地电脑存放的jar包的位置,需要指定
5、这个是设置本地局域网内的nexus地址
6、这个是设置访问本地maven的用户名密码设置
7、按照模板设置完成就可以使用局域网本地仓库进行jar包下载 编译的速度会变快很多。