Recently I migrated an application from maven2.x to maven3.x. And the only issue we faced was that profiles.xml was used in maven2. Here is the warning raised by maven3 while building.
[Warning]Detected profiles.xml alongside xx, this file is no longer supported and was ignored, please use the settings.xml instead
Since we had all the properties for building in profiles.xml so the first step we took was to copy these properties into pom.xml. And after copying to pom.xml the build started to work fine. But it was not an option for us to keep the properties in pom.xml as many of these properties were local to the user building the system. So we did not want to have these local changes accidentally being put to the code repository.
After some research we decided to use properties-maven-plugin which would allow us to extract the properties out of the pom.xml and into a properties file. Here is the the plugin:
<plugin><br /> <groupId>org.codehaus.mojo</groupId><br /> <artifactId>properties-maven-plugin</artifactId><br /> <version>1.0-alpha-2</version><br /> <executions><br /> <!-- Associate the read-project-properties goal with the initialize phase,<br /> to read the properties file. --><br /> <execution><br /> <phase>initialize</phase><br /> <goals><br /> <goal>read-project-properties</goal><br /> </goals></p> <p> <configuration><br /> <files><br /> <file>../com.tak/build.properties</file><br /> </files><br /> </configuration><br /> </execution><br /> </executions><br /> </plugin>
So we created a file build.properties and had it next to pom needing the properties. This gave us the liberty to have these properties locally independent of pom.xml. So pom.xml could be changed by developers at point of time.
Here I have also given a utility class to extract all the properties from pom.xml and put it into a properties file.