Maven profiles.xml issue (MNG-3933)

If you’re using a profiles.xml file to store your profiles and want to migrate from Maven 2.0.x to Maven 2.1.x or later chances are you’ll run into a build failure. In my case the error message was “Reason: Failed to activate local (project-level) build profiles: Cannot parse profiles.xml resource from directory: …

The root cause of this from the stack trace might look like this:

Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: Expected root element 'profilesXml' but found 'profiles' (position: START_TAG seen <?xml version="1.0" encoding="UTF-8"?>\r\n    <profiles>... @2:15)

This is easily solved by wrapping your whole content of the profiles.xml file in a profilesXML tag. So your profiles file should look similar to the example below.

<profilesXml xmlns="" xmlns:xsi="" xsi:schemaLocation="">

For more information you can see the mailing list thread or this JIRA bug.