To start using the plugin you will need to configure the repository location for the plugin.
<project>
...
<pluginRepositories>
<pluginRepository>
<id>croche-releases</id>
<url>http://croche.googlecode.com/svn/repository/releases</url>
</pluginRepository>
</pluginRepositories>
...
</project>To configure the merged files you have to add one or more merges which represents the merge of a set of files into a single target file.
<project>
...
<build>
<plugins>
<plugin>
<groupId>croche.maven</groupId>
<artifactId>maven-merge-file-plugin</artifactId>
<executions>
<execution>
<id>merge-release-notes</id>
<phase>process-resources</phase>
<goals>
<goal>merge</goal>
</goals>
<configuration>
<merges>
<merge>
<targetFile>docs/all-release-notes.txt</targetFile>
<sourceDirs>
<sourceDir>docs</sourceDir>
</sourceDirs>
<includes>
<include>release-notes.txt</include>
</includes>
</merge>
</merges>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</project>The example configuration above merges release notes files in the docs directory into a single release notes file all-release-notes.txt, for example if there were files called component1-release-notes.txt, component2-release-notes.txt, component3-release-notes.txt in this directory it would append them together.
<project>
...
<build>
<plugins>
<plugin>
<groupId>croche.maven</groupId>
<artifactId>maven-merge-file-plugin</artifactId>
<executions>
<execution>
<id>merge-sql</id>
<phase>process-resources</phase>
<goals>
<goal>merge</goal>
</goals>
<configuration>
<merges>
<merge>
<targetFile>database/install-all.sql</targetFile>
<sourceDirs>
<sourceDir>database</sourceDir>
</sourceDirs>
<nameContainsOrderings>
<nameContainsOrdering>recreate-schema.sql</nameContainsOrdering>
<nameContainsOrdering>create-schema.sql</nameContainsOrdering>
<nameContainsOrdering>schema-objects</nameContainsOrdering>
<nameContainsOrdering>indices</nameContainsOrdering>
<nameContainsOrdering>data</nameContainsOrdering>
</nameContainsOrderings>
<includes>
<include>.sql</include>
</includes>
<separator>-- ***** SQL File: #\{parent.name\}/#\{file.name\} *****\\n\\n</separator>
<encoding>UTF-8</encoding>
</merge>
</merges>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</project>The example configuration above merges any SQL files in the ${project.build.directory}/database and any of its subdirectories into a single SQL file ${project.build.directory}/database/install-all.sql. It would first append any files with recreate-schema.sql in their name, followed by create-schema.sql in their name, followed by schema-objects in their name, followed by indices in their name and finally followed by data in their name. It adds a SQL comment at the top of each appended file. I use this where I have several EAR projects that main their own SQL scripts for creating a schema that they use. Within each of these projects they have a script to drop/create the database schema, the objects (tables, views, functions, procedures), additional column indices, and some initial static data. The configuration above merges them into a single install SQL script that I can use to setup the database from scratch where I want the drop/create schema queries to run first, followed by the create tables, then the create indices and finally the static data inserts.