Maven profiles.xml issue (MNG-3933)
By Andrius Miasnikovas
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="http://maven.apache.org/PROFILES/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/PROFILES/1.0.0 http://maven.apache.org/xsd/profiles-1.0.0.xsd">
<profiles>
<profile>
...
</profile>
</profiles>
</profilesXml>
For more information you can see the mailing list thread or this JIRA bug.