如果你开始大量使用Maven
profile,你会希望将profile从POM中分离,使用一个单独的文件如profiles.xml。你可以混合使用定义在pom.xml中和外部profiles.xml文件中的profile。只需要将profiles元素放到/data/hudson-temporal-data/hudson-orchestrator-home/workspace/Book-To-Production/content-zh目录下的profiles.xml文件中,然后照常运行Maven就可以。profiles.xml文件的大概内容如下:
Example 11.6. 将profile放到一个profiles.xml文件中
<profiles>
<profile>
<id>development</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<debug>true</debug>
<optimize>false</optimize>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>production</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<debug>false</debug>
<optimize>true</optimize>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>你可以发现一旦你的Profile变得很大,再让你管理pom.xml会变得很困难,或者说只是因为你觉得将文件从中profiles.xmlpom.xml分离出来是一种更干净的方式。不管怎样,调用定义在pom.xml中的profile和调用定义在profiles.xml中profile的方式是一样的。

