maven仓库报错处理办法
maven仓库目录结构配置
至今为止及其靠谱的settings.xml
<?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 Default: ${user.home}/.m2/repository -->
<localRepository>D:\maven\localrepository</localRepository>
<!--
interactiveMode Default: true
<interactiveMode>true</interactiveMode>
-->
<!--
offline Default: false
<offline>false</offline>
-->
<pluginGroups>
<!-- <pluginGroup>com.your.plugins</pluginGroup>-->
</pluginGroups>
<proxies>
<!--
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
-->
</proxies>
<servers>
<!-- server
<server>
<id>deploymentRepo</id>
<username>repouser</username>
<password>repopwd</password>
</server>
-->
<!--
<server>
<id>siteServer</id>
<privateKey>/path/to/private/key</privateKey>
<passphrase>optional; leave empty if not used.</passphrase>
</server>
-->
</servers>
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/repository/public</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>aliyun1</id>
<repositories>
<repository>
<id>阿里云中央仓库</id>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>aliyun2</id>
<repositories>
<repository>
<id>阿里云google仓库</id>
<url>https://maven.aliyun.com/repository/google</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>aliyun3</id>
<repositories>
<repository>
<id>阿里云gradle-plugin仓库</id>
<url>https://maven.aliyun.com/repository/gradle-plugin</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>aliyun4</id>
<repositories>
<repository>
<id>阿里云spring仓库</id>
<url>https://maven.aliyun.com/repository/spring</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>aliyun5</id>
<repositories>
<repository>
<id>阿里云spring-plugin仓库</id>
<url>https://maven.aliyun.com/repository/spring-plugin</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>aliyun6</id>
<repositories>
<repository>
<id>阿里云grails-core仓库</id>
<url>https://maven.aliyun.com/repository/grails-core</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>aliyun7</id>
<repositories>
<repository>
<id>阿里云apache snapshots仓库</id>
<url>https://maven.aliyun.com/repository/apache-snapshots</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>aliyun1</activeProfile>
<activeProfile>aliyun2</activeProfile>
<activeProfile>aliyun3</activeProfile>
<activeProfile>aliyun4</activeProfile>
<activeProfile>aliyun5</activeProfile>
<activeProfile>aliyun6</activeProfile>
<activeProfile>aliyun7</activeProfile>
</activeProfiles>
</settings>
如何让maven依次扫描多个仓库
无法解析包怎么办
阿里云有许多仓库,一般只扫描public仓库,很有可能你需要的包在其他仓库,不在public仓库。
maven坑爹的是,无论你在[HTML_REMOVED]中写多少个[HTML_REMOVED],它只会扫描第一个。
所以在包搜索不到时,可以尝试更换settings.xml
中,第一个[HTML_REMOVED]的地址,然后重新加载
maven插件报错怎么办
手动在下方添加版本号,不知道填哪个版本可以去仓库中搜索
版本任意,不会与项目版本冲突
maven依赖继承报错怎么办
经过实测发现,依赖继承报错不影响项目正常运行
警告
1.不要随便改动源项目的版本,不同版本间的方法差异很大,可能导致项目无法运行