对maven私服配置的说明

来源:互联网 发布:c语言是不是高级语言 编辑:程序博客网 时间:2024/05/16 11:06
<?xml version="1.0" encoding="UTF-8"?><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>F:/.m2/repository</localRepository>    <pluginGroups>  </pluginGroups>  <proxies>  </proxies>  <!--设置私库认证信息-->  <servers>  <server>    <id>nexus-releases</id>    <username>admin</username>    <password>admin123</password>  </server>  <server>    <id>nexus-snapshots</id>    <username>admin</username>    <password>admin123</password>  </server>  </servers>    <!--设置私库mirror 表示maven所有的请求都由nexus来处理-->  <mirrors><mirror><id>nexus</id><mirrorOf>*</mirrorOf><name>Nexus Mirror.</name><url>http://localhost:8081/nexus/content/groups/public</url></mirror>  </mirrors>  <!--设置maven私库信息-->  <profiles>  <profile><id>nexus</id><repositories>  <repository><id>nexus</id><name>Nexus</name><url>http://localhost:8081/nexus/content/groups/public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots>  </repository></repositories><pluginRepositories>  <pluginRepository><id>nexus</id><name>Nexus</name><url>http://localhost:8081/nexus/content/groups/public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots>  </pluginRepository></pluginRepositories>    </profile>    <!--覆盖maven中央仓库设置开启releases和snapshots版本的下载--><profile><id>central</id><repositories> <repository><id>central</id><url>http://central</url><releases><enabled>true</enabled>    </releases>    <snapshots><enabled>true</enabled>       </snapshots></repository></repositories><pluginRepositories><pluginRepository><id>central</id><url>http://central</url><releases><enabled>true</enabled>    </releases>    <snapshots><enabled>true</enabled>       </snapshots></pluginRepository></pluginRepositories>    </profile>  </profiles>  <!--激活私库信息的配置--><activeProfiles>    <activeProfile>nexus</activeProfile><activeProfile>central</activeProfile></activeProfiles></settings>在项目的pom文件中做如下设置<!-- nexus-releases nexus-snapshots与settings.xml中server下的id对应 --><distributionManagement><repository><id>nexus-releases</id><name>Nexus Releases Repository</name><url>http://localhost:8081/nexus/content/repositories/releases/</url></repository><snapshotRepository><id>nexus-snapshots</id><name>Nexus Snapshots Repository</name><url>http://localhost:8081/nexus/content/repositories/snapshots/</url></snapshotRepository></distributionManagement>

原创粉丝点击