Fork me on GitHub

Usage

This document is intended to provide instructions for using the Directory Content Maven Plugin.

In order for this discussion to be useful, it's critical to cover two topics:

  1. Configuring your project's pom.xml to run the plugin during the project's build cycle
  2. Invoking the plugin from the command-line

Configuring Plugin

By tying the goals of the plugin to a phase in the build cycle, the specified goals will run each time that phase of the build cycle is executed. Doing this can make it easier to add the plugin to your project, because it eliminates the need to run the plugin standalone.

To bind a goal of the Directory Content Maven Plugin to a phase in the build cycle, you will need to add the execution tag with the goal set to goal name (e.g transformList). Optionally, you can bind the plugin to a different build phase by using the phase option. For instance, using process-sources in the phase option will force the transformList goal to run each time this phase of the build cycle occurs.

For a complete list of the available configuration options see goal overview page.

Example for the transformList goal:

<project>
   ...
   <build>
      <plugins>
         ...
         <plugin>
            <groupId>biz.gabrys.maven.plugins</groupId>
            <artifactId>directory-content-maven-plugin</artifactId>
            <version>1.1.0</version>
            <executions>
               <execution>
                  <id>default-transformList</id>
                  <phase>process-sources</phase> <!-- When omitted defaults to 'generate-sources' -->
                  <goals>
                     <goal>transformList</goal>
                  </goals>
                  <configuration>
                     <!-- put your configurations here -->
                  </configuration>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
<project>

If you want to use snapshot, then you need to add the oss.sonatype.org repository to your pom.xml:

<pluginRepositories>
   <pluginRepository>
      <id>sonatype-nexus-snapshots</id>
      <name>Sonatype's SNAPSHOT repository</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
      <releases>
         <enabled>false</enabled>
      </releases>
      <snapshots>
         <enabled>true</enabled>
      </snapshots>
   </pluginRepository>
</pluginRepositories>

Invoke from the command-line

The goals for the Directory Content Maven Plugin are bound to their respective phases in the build lifecycle. So to compile your sources, you need only to tell Maven until which lifecycle to execute.

The following will transform directory files list (see configuration in previous section):

mvn process-sources

You can also transform directory files list by execute only this plugin:

mvn biz.gabrys.maven.plugins:directory-content-maven-plugin:transformList