Integrating BIRT (POJO engine) with maven ought to be as simple as placing the following dependency into your pom.xml:
<dependency>
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.eclipse.birt.runtime</artifactId>
<version>4.3.0</version>
</dependency>
<br />
Unfortunately as soon as you do that you run into the first problem: there is a dependency on a private build of Apache POI that is not in maven. To work around this you can exclude that build of POI and bring in the full version:
<dependency>
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.eclipse.birt.runtime</artifactId>
<version>4.3.0</version>
<exclusions>
<exclusion>
<artifactId>org.apache.poi</artifactId>
<groupId>org.eclipse.birt.runtime</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<br />
That will work, but it still has a few problems:
<br />
- Although the main Apache POI classes have been excluded from the mavenised BIRT, they have failed to remove a lot of other classes (e.g. the XML beans schema classes for the MS Office file formats).<br />
The inclusion of these files doesn't stop BIRT from working as long as you are using POI 3.9, though they do bloat the resulting jar.<br />
If you want to use POI 3.10 the inclusion of these files could present real problems as that will come with (probably different) versions.<br />
- BIRT comes with the SpudSoft BIRT Excel Emitters, which makes it difficult to replace them with newer versions from BitBucket.<br />
<br />
So, if you want to use a new version of either POI or the SpudSoft Excel Emitters (which I recommend) you have to take more steps.<br />
<br />
The approach to take is to use the maven shade plugin to modify the BIRT jar file, stripping out the unwanted files and, as a bonus, replacing any files within the jar that are found to contain bugs.<br />
<br />
The attached zip file contains a complete maven project that results in a new BIRT jar file that you can deploy to your local maven repository.<br />
<br />
At a minimum the maven shade project needs to contain the following files:
<br />
- /pom.xml<br />
- /src/main/resources/plugin.xml<br />
Modified to remove the built-in version of the SpudSoft Excel Emitters.<br />
- /src/main/resources/META-INF/MANIFEST.MF<br />
Modified to remove all the hashes for the compiled jars.<br />
<br />
The key parts of the pom.xml are the base dependency:
<dependency>
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.eclipse.birt.runtime</artifactId>
<version>4.3.0</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.apache.poi</artifactId>
</exclusion>
</exclusions>
</dependency>
<br />
and the maven shade configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.0</version>
<configuration>
<createSourcesJar>true</createSourcesJar>
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
<artifactSet>
<includes>
<include>org.eclipse.birt.runtime:org.eclipse.birt.runtime</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>org.eclipse.birt.runtime:org.eclipse.birt.runtime</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>org/apache/**</exclude>
<exclude>org/dom4j/**</exclude>
<exclude>org/eclipse/birt/report/engine/emitter/excel/**</exclude>
<exclude>org/openxmlformats/**</exclude>
<exclude>org/w3c/**</exclude>
<exclude>schemaorg_apache_xmlbeans/**</exclude>
<exclude>schemasMicrosoftCom*/**</exclude>
<exclude>uk/co/spudsoft/**</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<br />
As a bonus the zip also contains a replacement for the file /src/main/java/org/eclipse/birt/report/engine/executor/ListingElementExecutor.java which fixes
BIRT bug 413607.<br />
<br />
When you use the jar file that this produces you must ensure that you add in a dependency for the correct version of POI and the SpudSoft Excel Emitters (which I'm afraid are
not in maven yet, you should add them to your local maven repository manually).<br />
<br />
I hope this is helpful to someone.