maven : Failed to install metadata project Could not parse metadata maven-metadata-local.xml: only whitespace content allowed before start tag

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!


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 https://github.com/takari/takari-local-repository 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.