If you've never used a Maven plugin before please take a look at Maven's Getting Started Guide.
To use the plugin in your project you have to add it to the plugins section of your POM.
<plugin>
<groupId>org.jibx</groupId>
<artifactId>maven-jibx-plugin</artifactId>
<version>1.2.3-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>bind</goal>
</goals>
</execution>
</executions>
</plugin>
The project also needs to include jibx-run and optionally jibx-extras in its dependencies.
<dependency> <groupId>org.jibx</groupId> <artifactId>jibx-run</artifactId> <version>1.2.3-SNAPSHOT</version> </dependency> <dependency> <groupId>org.jibx</groupId> <artifactId>jibx-extras</artifactId> <version>1.2.3-SNAPSHOT</version> </dependency>
The plugin supports the following configuration options.
| option | default | description |
| directory | src/main/config | In which directory to search for binding definitions. |
| includes | binding.xml | Which files in the configuration directory to include as binding definitions. |
| excludes | none | Which files in the configuration directory that will be matched by one the include patterns to exclude. |
| multi-module | false | Control flag to enable multi-module mode. (See modes.html#Multi-module mode) |
| modules | none | Which modules to include in multi-module mode. (See modes.html#Restricted multi-module mode) |
| load | false | Control flag for test loading generated/modified classes. |
| validate | true | Control flag for binding definition validation. |
| verbose | false | Control flag for verbose processing reports. |
| verify | false | Control flag for verifying generated/modified classes with BCEL. |
This example would include all files ending in -binding.xml except template-binding.xml in the src/main/jibx directory and output verbose messages during binding compilation:
<plugin>
<groupId>org.jibx</groupId>
<artifactId>maven-jibx-plugin</artifactId>
<version>1.2.3-SNAPSHOT</version>
<configuration>
<directory>src/main/jibx</directory>
<includes>
<include>*-binding.xml</include>
</includes>
<excludes>
<exclude>template-binding.xml</exclude>
</excludes>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<goals>
<goal>bind</goal>
</goals>
</execution>
</executions>
</plugin>
If you want the plugin and libraries to be automatically downloaded then include the respective repositories in your POM.
<repositories>
<repository>
<id>jibx.sf.net</id>
<name>JiBX repository</name>
<url>http://jibx.sf.net/maven2</url>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jibx.sf.net</id>
<name>JiBX repository</name>
<url>http://jibx.sf.net/maven2</url>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
Here is a complete sample pom file.
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.mycompany</groupId>
<artifactId>my-artifact-id</artifactId>
<version>3.4.5</version>
<build>
<plugins>
<plugin>
<groupId>org.jibx</groupId>
<artifactId>maven-jibx-plugin</artifactId>
<version>1.2.3-SNAPSHOT</version>
<configuration>
<directory>src/main/resources</directory>
<includes><include>*-binding.xml</include></includes>
<verbose>true</verbose>
</configuration>
<executions>
<execution><goals><goal>bind</goal></goals></execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-run</artifactId>
<version>1.2.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-extras</artifactId>
<version>1.2.3-SNAPSHOT</version>
</dependency>
</dependencies>
</project>