java web項目一直都是好好的,后面電腦安裝過系統后(以之前的版本不一樣),安裝所需軟件(如myeclipse、tomcat)並進行配置。然后在myeclipse中添加項目卻報錯了1.Archive for required library: ‘... .jar’ in project ‘xxxxxxxxx’ cannot be read or is not a valid ZIP file. 2. The project cannot be built until build path errors are resolved.但是我查找了一下那個jar確實是存在的。在網上查找了許久,答案不一:jar不完整、路徑問題等等。
解決方案:
1)刪除提示錯誤路徑下的所有jar包(C:\Documents and Settings\Administrator\.m2\repository\org...)。
2)安裝maven,詳細的安裝步驟點擊here,
3)開始—運行—cmd—進入到web項目所在路徑(cd:web項目的路徑)—(a)輸入mvn compile(編譯源代碼)回車;(b) mvn clean (清除目標目錄中的生成結果)回車;(c)輸入mvn clean install或者mvn clean install -DskipTests=true(下載所需jar)回車。