Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's wrong with my profiles.xml?

Tags:

maven-2

This is a portion of my profiles.xml for mvn:

<profilesXml>
  <profiles>
    <profile>
      <id>production</id>
      <build>
        <plugins> .. </plugins>
      </build>
    </profile>
  </profiles>
</profilesXml>

This is what mvn says:

Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: 
Unrecognised tag: 'build' (position: START_TAG seen ...</id>\n
        <build>... @32:20)

What's wrong here?

like image 479
yegor256 Avatar asked Jul 28 '10 08:07

yegor256


1 Answers

The error message is giving you the correct feedback here, you cannot specify a <build/> section in an external profile, you are only allowed to specify <properties>, <pluginRepositories>, and <repositories>. From the Introduction to Build Profiles:

Profiles in external files

Profiles specified in external files (i.e in settings.xml or profiles.xml) are not portable in the strictest sense. Anything that seems to stand a high chance of changing the result of the build is restricted to the inline profiles in the POM. Things like repository lists could simply be a proprietary repository of approved artifacts, and won't change the outcome of the build. Therefore, you will only be able to modify the <repositories> and <pluginRepositories> sections, plus an extra <properties> section.

The <properties> section allows you to specify free-form key-value pairs which will be included in the interpolation process for the POM. This allows you to specify a plugin configuration in the form of ${profile.provided.path}.

If your snippet is coming from a book, the book should be fixed.

like image 53
Pascal Thivent Avatar answered Sep 18 '22 22:09

Pascal Thivent