研究maven多模塊項目時,因為家里和公司不能同時開發,所以把家里搭建好的項目復制到公司繼續研究,
當時家里的電腦搭建好項目之后是沒問題的,但是復制到公司的eclipse上之后就看到pom文件出現下面的錯誤:
Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (execution: default-testCompile, phase: test-compile)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (execution: default-compile, phase: compile)
- CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be
resolved: The repository system is offline but the artifact com.google.collections:google-collections:jar:1.0 is not available in the local repository.
- CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be
resolved: The repository system is offline but the artifact com.google.collections:google-collections:jar:1.0 is not available in the local repository.
網上搜羅一大堆都沒找到解決辦法,最后在一個英文文檔找到了解決方案,翻譯是這樣的
這不是一個獨特的問題,偶爾發生(有時由於連接緩慢,有時由於代理服務器現在允許下載)
你可以通過以下任何一種方式來擺脫這個問題:
1)強制更新:右鍵單擊Eclipse中的項目> Maven >更新項目在該屏幕上選擇快照/發布的復選框強制更新
2)清除Maven緩存:如果您仍然面臨問題,請轉到系統上的本地存儲庫,該庫可能存在ATC:\\\用戶\ MyUrNeNe\\M2\ReaviToRyy,並刪除.cache文件夾,然后執行步驟1。
3)如果仍然面臨問題,手動轉到ORG/Apache文件夾,刪除所有內容,然后執行步驟1。(這肯定會解決這個問題。)
我用了第三種方法,意思就是將你的maven倉庫全刪掉,重新下載一遍,使用以下流程:
1、找到你的maven倉庫包位置,刪掉repository文件夾下的所有文件,
2、然后右擊項目->maven->update maven configuration...
offline和fore update of snapssots/Releases(強制更新)一定要勾選上,
下載完之后你會發現,問題解決了!!!
如果還不能解決,在pom文件加個依賴:
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
</dependency>
這樣就行了