Nov 28 2013
docx4j 3.0 and Maven
blog/2011/10/hello-maven-central/ walks you through the basics of using docx4j in an Eclipse project with the help of m2eclipse.
This post is about the different ways you can set up docx4j 3.0 with the help of Maven.
We’ll be using the following skeleton pom.xml:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>your.group</groupId> <artifactId>your.artifactp</artifactId> <name>nameless</name> <version>0.0.1-SNAPSHOT</version> <description> some description </description> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.0</version> </plugin> </plugins> </build> <dependencies> <!-- dependencies go here --> </dependencies> </project>
Adding the core dependency
To use docx4j, including its LGPL XHTML import capability, just include the following dependency in your pom.xml:
<dependency> <groupId>org.docx4j</groupId> <artifactId>docx4j-ImportXHTML</artifactId> <version>3.0.0</version> </dependency>
<dependency> <groupId>org.docx4j</groupId> <artifactId>docx4j</artifactId> <version>3.0.0</version> </dependency>
<dependency> <groupId>org.docx4j</groupId> <artifactId>docx4j-ImportXHTML</artifactId> <version>3.0.0</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </exclusion> <exclusion> <groupId>log4j</groupId> <artifactId>log4j</artifactId> </exclusion> </exclusions> </dependency>
/sourcecode]



), you can post in our 



