異常1:
[error] failed to execute goal on project biz_zhuhai: could not resolve dependencies for project biz_zhuhai:biz_zhuhai:jar:0.0.1-snapshot: failed to collect dependencies for [com.maywide.ibh:lib345:pom:1.0 (compile)]: failed to read artifact descriptor for com.maywide.ibh:lib345:pom:1.0: could not transfer artifact com.maywide.ibh:lib345:pom:1.0 from/to releases (http://localhost:9888/nexus-2.0.3/content/repositories/releases): connection to http://localhost:9888 refused: connection refused: connect -> [help 1]
解決方法:
這是配置的url有錯誤或者是私服沒有配好,導緻構件下載下傳時出錯。如果沒有jar包需要在私服裡下載下傳,可以不配置私服的,也就是可以把setting.xml的profiles裡的東西全部删除的。
異常2:
[error] failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project web_nanchang: there are test failures.
[error]
[error] please refer to e:\maven\web_nanchang\target\surefire-reports for the individual test results.
這是因為測試代碼時遇到錯誤,它會停止編譯。隻需要在pom.xml的<project>裡添加以下配置,使得測試出錯不影響項目的編譯。
異常3:
[error] failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.0.6:start (start-container) on project myproject: execution start-container of goal org.codehaus.cargo:cargo-maven2-plugin:1.0.6:start failed: error while expanding c:\docume~1\admini~1\locals~1\temp\cargo\installs\apache-tomcat-6.0.29.zip
[error] java.io.ioexception: negative seek offset
[error] -> [help 1]
[error] to see the full stack trace of the errors, re-run maven with the -e swit
ch.
[error] re-run maven using the -x switch to enable full debug logging.
[error] for more information about the errors and possible solutions, please rea
d the following articles:
[error] [help 1] http://cwiki.apache.org/confluence/display/maven/pluginexecutio
nexception
自己下載下傳“apache-tomcat-6.0.29.zip”,将下載下傳好的檔案拷貝到指定檔案夾“c:\documents and settings\administrator\local settings\temp\cargo\installs”下。
異常4:
[error] failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project web_nanchang: error assembling war: webxml attribute is required (or pre-existing web-inf/web.xml if executing in update mode) -> [help 1]
[error] to see the full stack trace of the errors, re-run maven with the -e switch.
[error] for more information about the errors and possible solutions, please read the following articles:
maven的web項目預設的webroot是在src\main\webapp。如果在此目錄下找不到web.xml就抛出以上的異常。解決方法在pom.xml加入以下的配置。紅色字型改成你網站的根目錄。
異常5:
eclipse中maven工程缺少maven dependencies
産生這種現象的原因可能是工程對應的開發環境改變,本地maven倉庫位址和原來的不一緻。其根本原因是maven project的maven選項未開啟或啟動無效。
為了解決這個問題我們隻需要重新開機dependency management就可以了。
具體步驟:右擊 maven project --> macven --> enable dependency management
說明:如果我們原有的工程中的maven處于enable狀态下,但是同樣沒有maven dependencies類庫,我們将原有的maven project執行disable dependency management,然後再重新開機下就行了。