1. 程式人生 > >解決Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install的錯誤

解決Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install的錯誤

環境:idea編譯器,SSM框架。

一.報錯:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on project XXX: Failed to install metadata XXX/maven-metadata.xml: Could not parse metadata 路徑\maven-metadata-local.xml: only whitespace content allowed before start tag and not \u0 (position: START_DOCUMENT seen \u0... @1:1) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] Maven execution terminated abnormally (exit code 1)

Java專案編譯時報錯。

二.原因:

不能編譯xx路徑下的maven-metadata-local.xml,這個maven-metadata-local.xml的作用是記錄了專案元資料,例如groupId,artifactId,version。我們的每次提交都會更新maven-metadata-local.xml,當在maven倉庫下載jar包時,也會根據這個檔案進行jar包的查詢。

沒有關專案,又直接運行了,maven-metadata-local.xml被佔用無法編譯。

三.解決:

找到路徑下的maven-metadata-local.xml,刪除掉,然後clean一下專案就可以了。