Maven自用配置文件(settings.xml)
【代码】Maven自用配置文件。
·
<?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>D:\repository</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
<mirror>
<id>mirror</id>
<mirrorOf>central,jcenter</mirrorOf>
<name>mirror</name>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>jdk-1.8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
</settings>
mirrorOf为<mirrorOf>central</mirrorOf>,如果<mirrorOf></mirrorOf>我随便设置一个参数,如<mirrorOf>abc</mirrorOf>,这时候我们配置的仓库就不起作用了,这是因为maven默认内置了如下一个仓库,这个默认仓库的id为central,当我们把mirrorOf设置为<mirrorOf>central</mirrorOf>时,maven就会查找有没有id为central的仓库,然后把id为central的仓库地址换成我们<mirror>标签配置的那个url,这样我们配置的mirror才会起作用。当然我们也可以把mirrorOf设置为<mirrorOf>*</mirrorOf>,表示所有仓库都使用我们配置的这个mirror作为jar包下载地址。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)