Got this error when I was trying to build a project which I just downloaded from SVN.

Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on project : Failed to install metadata project:1.0-SNAPSHOT/maven-metadata.xml: Could not parse metadata C:\Users.m2\project\1.0-SNAPSHOT\maven-metadata-local.xml: only whitespace content allowed before start tag and not \u0 (position: START_DOCUMENT seen \u0... @1:1) -> [Help 1]

4 Answers

I just wanted to document this error on the internet. There was no much help or I didn't search properly.

Answer :

Go to the the path where the maven-metadata-local.xml is. Delete the project folder along with the xml and build the project.

It worked for me!

8

Deleting the project folder and the maven-metadata-local.xml in the local repository solves the problem as stated by eugene-s's answer.

Even though the problem in the question does not seem to be caused by concurrent usage of the local maven repository, this problem often occurs in a CI environment when the various jobs use the same maven local repository system.

You can either go with the solution (by user2818782) to always user a fresh repository, or you can start using which is a replacement to the local maven repository that is safe for concurrent access.

By adding the

" -Dmaven.repo.local=$WORKSPACE/.repository"

argument to your mvn install command it forces Maven to use a local private repository, instead of the central one (~/.m2/repository).

Every Maven build will start with a fresh repository, thus avoiding such conflicts. This trick does however come with the caveat that it now needs to download EvERYTHING. So expect dramatically increased network traffic (not a problem if you use a local Nexus as a mirror), and slightly longer build times.

We got the same problem in a project right after modifying the pom.xml to add some plugins and configurations. Deleting the project folders from maven local repository cache solved it.