Thursday, August 22, 2013

Maven - How to merge files


You can use maven-merge-properties-plugin to merger property files.

<plugin>
    <groupId>org.beardedgeeks</groupId>
    <artifactId>maven-merge-properties-plugin</artifactId>
    <version>0.1.1</version>
    <configuration>
     <merges>
      <merge>
       <targetFile>${Target file name with the src path}</targetFile>
       <propertiesFiles>
        <propertiesFile>${property file 1 with the src path}</propertiesFile>
        <propertiesFile>${property file 2 with the src path}</propertiesFile>
        <propertiesFile>${property file 3 with the src path}</propertiesFile>
        <propertiesFile>${property file 4 with the src path}</propertiesFile>
       </propertiesFiles>
      </merge>          
     </merges>
    </configuration>
    <executions>
     <execution>
      <phase>compile</phase>
      <goals>
       <goal>merge</goal>
      </goals>
     </execution>
    </executions>
   </plugin>