maven在鏡像地址中獲取依賴包的時候報錯:
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:3.1 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-resources-plugin:jar:3.1 in http://maven.aliyun.com/nexus/content/repositories/central/ was cached in the local repository, resolution will not be reattempted until the update interval of alimaven-central has elapsed or updates are forced
Plugin org.apache.maven.plugins:maven-resources-plugin:3.1 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-resources-plugin:jar:3.1 in http://maven.aliyun.com/nexus/content/repositories/central/ was cached in the local repository, resolution will not be reattempted until the update interval of alimaven-central has elapsed or updates are forced
1.首先將maven的setting文件的本地倉庫和鏡像倉庫修改
<mirror>
<id>alimaven-central</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
<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
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<localRepository>E:/learn/maven/repo</localRepository>
<!-- interactiveMode
| This will determine whether maven prompts you when it needs input. If set to false,
| maven will use a sensible default value, perhaps based on some other setting, for
| the parameter in question.
|
| Default: true
<interactiveMode>true</interactiveMode>
..省略其他配置......
........
設置之後本地資源路徑就在E:/learn/maven/repo 遠端的就使用aliyun的鏡像地址獲取jar包http://maven.aliyun.com/nexus/content/repositories/central/
2..然後將maven的setting文件指向本地的文件
設置之後需要update settings。
3.將原來默認地址的jar包和本地倉庫jar包全部刪除。
4.將pom.xml文件裏的版本修改成:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
原來是3.1 一直都下載不到。因爲阿里雲鏡像倉庫地址不能夠查看,所以直接把版本修改了
5.到pom.xml路徑下使用mvn install 編譯完成
6.maven--->update project
pom.xml裏有這個以來,但是在mvn compile的時候一直報錯
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1.0</version>
</plugin>
解決:直接刪除,然後執行mvn compile 去遠端重新下載
其他幾個mvn執行命令有報錯也是一樣解決