I like to use the FMPP Maven Mojo, but I have not found any documentation about this maven-plugin, I summarize in this blog the basic configuration of this plugin.
About the FMPP Maven Mojo
First a copy-paste description from the site/generate-mojo.html file of the original plugin.Full name
com.googlecode.fmpp-maven-plugin:fmpp-maven-plugin:1.0:generateDescription
Generates artifacts as configured. The output is placed in configured output directory.
Attributes
- Requires a Maven 2.0 project to be executed.
- Binds by default to the lifecycle phase:
generate-sources
.
Full name
com.googlecode.fmpp-maven-plugin:fmpp-maven-plugin:1.0:generateRequired Parameters
Name | Type | Since | Description |
---|---|---|---|
cfgFile | File | 1.0 | Location of the FreeMarker config file. Default value is: src/main/resources/fmpp/config.fmpp . |
outputDirectory | File | - | Location of the output files. Default value is: ${project.build.directory}/generated-sources/fmpp/ . |
templateDirectory | File | 1.0 | Location of the FreeMarker template files. Default value is: src/main/resources/fmpp/templates/ . |
Parameter Details
cfgFile:
Location of the FreeMarker config file.
- Type:
java.io.File
- Since:
1.0
- Required:
Yes
- Default:
src/main/resources/fmpp/config.fmpp
outputDirectory:
Location of the output files.
- Type:
java.io.File
- Required:
Yes
- Default:
${project.build.directory}/generated-sources/fmpp/
templateDirectory:
Location of the FreeMarker template files.
- Type:
java.io.File
- Since:
1.0
- Required:
Yes
- Default:
src/main/resources/fmpp/templates/
Examples
Some examples using the fmpp-maven-pluginExample 1
Let say you have a fmpp configuration file in src/main/resources/fmpp/config.fmpp. The templates files are located in the directory src/main/resources/fmpp/templates. Finally the generated output files shall go in the target directory under generated-sources/fmpp.The directory layout for this example:
+
|- pom.xml
|- src
| |
| +- main
| |
| +- resources
| |
| + fmpp
| |
| +- config.fmpp
| +- templates
| |
| +- ....
|- target
| |
| +- generated-sources
| |
| + fmpp
| |
| +- ....
The plugin definition
...
<plugin>
<groupId>com.googlecode.fmpp-maven-plugin</groupId>
<artifactId>fmpp-maven-plugin</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>net.sourceforge.fmpp</groupId>
<artifactId>fmpp</artifactId>
<version>0.9.15</version>
</dependency>
</dependencies>
<configuration>
<cfgFile>src/main/resources/fmpp/config.fmpp</cfgFile>
<templateDirectory>src/main/resources/fmpp/templates</templateDirectory>
<outputDirectory>${project.build.directory}/generated-sources/fmpp</outputDirectory>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
...
Note: The explicit dependency definition using fmpp version 0.9.15, per default an older version is used missing eg JSON data loader.
Kommentare
Kommentar veröffentlichen