Apache Batik with Maven 2

Today I just wanted to try some SVG graphics within a new Swing application.  The build is based on Maven 2 and so it should have been relatively easy to add the stuff to the project . . .

I checked the Fornax Respository and found about 18 Artifacts! Hmmm . . . Which one to use? Most of them don’t have any dependencies inside. Finally I discovered that it’s the Batik SVG Rasterizer that has the necessary declarations inside. 

Additionally I added Batik Swing because it sounds like I’d need it inside a Swing application 😉

I started the application and got a 

java.lang.NoClassDefFoundError: org/w3c/dom/svg/SVGSVGElement

Exception . . .

It took me some time to find the necessary XML APIs within the Maven respository but at least I succeeded…

Here are my Maven dependencies – Maybe this will save you some time:

<dependency>
    <groupId>xml-apis</groupId>
    <artifactId>xml-apis-ext</artifactId>
    <version>1.3.04</version>
</dependency>
<dependency>
    <groupId>xml-apis</groupId>
    <artifactId>xml-apis</artifactId>
    <version>1.3.04</version>
</dependency>
<dependency>
    <groupId>batik</groupId>
    <artifactId>batik-rasterizer</artifactId>
    <version>1.6</version>
</dependency>
<dependency>
    <groupId>batik</groupId>
    <artifactId>batik-swing</artifactId>
    <version>1.6</version>
</dependency>
Advertisements

5 thoughts on “Apache Batik with Maven 2

      1. Oops never mind it is in the main repo. The new groupId threw me off more than it should.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s