What you can do is to use the Properties Maven plugin. This will let you define your properties in an external file, and the plugin will read this file.
With this configuration :
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>my-file.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
and if you have, in your properties file the following lines:
spring-version=1.0
mysql-version=4.0.0
then it's the same thing as if you wrote, in your pom.xml, the following lines:
<properties>
<spring-version>1.0</spring-version>
<mysql-version>4.0.0</mysql-version>
</properties>
Using this plugin, you will have several benefits:
- Set easily a long list of properties
- Modify the values of these properties without modifying the parent pom.xml.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…