<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"> <!--就是配置maven本地仓库的地址为自定义的地址--> <localRepository>C:\Users\abc\.m2\repository_demo</localRepository> <!--nexus服务器--> <servers> <server> <id>releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>snapshots</id> <username>admin</username> <password>admin123</password> </server> <server> <id>public</id> <username>admin</username> <password>admin123</password> </server> </servers> <mirrors> <mirror> <id>public</id> <mirrorOf>central</mirrorOf> <name>public central</name> <url>http://localhost:8081/repository/my_group/</url> </mirror> </mirrors> <profiles> <profile> <id>default</id>
<repositories> <repository> <id>releases</id> <url>http://localhost:8081/repository/my_hosted_release/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>snapshots</id> <url>http://localhost:8081/repository/my_hosted_snapshots/</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository> </repositories>
<!--从远处仓库下载 public 包含了可以不用配置--> <pluginRepositories> <pluginRepository> <id>releases</id> <url>http://localhost:8081/repository/my_hosted_release/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> <pluginRepository> <id>snapshots</id> <url>http://localhost:8081/repository/my_hosted_snapshots/</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>default</activeProfile> </activeProfiles> </settings>
上传到私有库配置
<!--上传到私有库--> <distributionManagement> <repository> <id>releases</id> <name>internal releases</name> <url>http://localhost:8081/repository/my_hosted_release/</url> </repository> <snapshotRepository> <id>snapshots</id> <name>internal snapshot</name> <url>http://localhost:8081/repository/my_hosted_snapshots/</url> </snapshotRepository> </distributionManagement>