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.