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> <groupId>org.codehaus.mojo</groupId> <artifactId>properties-maven-plugin</artifactId> <version>1.0-alpha-2</version> <executions> <!-- Associate the read-project-properties goal with the initialize phase, to read the properties file. --> <execution> <phase>initialize</phase> <goals> <goal>read-project-properties</goal> </goals> <configuration> <files> <file>../com.tak/build.properties</file> </files> </configuration> </execution> </executions> </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.