Maven2 error: Cannot read metadata

Published: Saturday, 12 May 2012
maven

Error retrieving previous build number for artifact, Cannot read metadata from, expected START_TAG or END_TAG not TEXT

If you see the following error:

Error retrieving previous build number for artifact 'com.example:example:jar':
Cannot read metadata from '/.m2/repository/com/example/example/1.1-SNAPSHOT/maven-metadata-snapshots.xml':
expected START_TAG or END_TAG not TEXT (position: TEXT seen ...<classifier>sources</... @14:30)

Then upgrade your maven from 2.0.9. I used 2.2.1 then my build worked again.