tags:

views:

1357

answers:

3

The JAI setup is quite tedious, involving multiple jars and environment variables. It would aid the project's portability quite a lot if I could add it as a regular Maven dependency.

The POM snippet I'm using is

<dependency>
  <groupId>com.sun.media</groupId>
  <artifactId>jai_imageio</artifactId>
  <version>1.1</version>
</dependency>

and the errors are

[INFO] ------------------------------------------------------------------------                               
[ERROR] BUILD ERROR                                                                                             
[INFO] ------------------------------------------------------------------------                                 
[INFO] Failed to resolve artifact.                                                                              

Missing:   
----------
1) com.sun.media:jai_imageio:jar:1.1
2) javax.media:jai_core:jar:1.1.3

I can, of course, download and install those jars. The problem is twofold:

  • jai_imageio requires two jars;
  • jai_imageio requires a native library to be installed and two environment variables to be set.

I have not found a way to make this work with Maven.


See Reading JCS_YCCK images using ImageIO for the reason I'm using JAI.

+1  A: 

You're going to need to download the jars and install them in your local maven repository, or local repository proxy server (Nexus/Artifactory). I think you can use the maven-enforcer-plugin to validate that the environment settings are there.

The licence for jai_imageio doesn't allow for it to be distributed.

Mike Cornell
Thanks for the answer. I was afraid of that, but I guess I need to create my own POMs for it.
Robert Munteanu
Well the POMs for the files already exists. http://mirrors.ibiblio.org/pub/mirrors/maven2/com/sun/media/jai_imageio/1.1/jai_imageio-1.1.pom It does have the required dependancy of jai_core. The downside is it has that downloadURL in the distribution management.
Mike Cornell
A: 

What I failed to see was that the JAI dependency needed to be satisfied only at runtime, and therefore I made sure the production environment has access to JAI, by configuring it for Tomcat.

Robert Munteanu
A: 

try this:

<dependency>
  <groupId>com.sun.media</groupId>
  <artifactId>jai_imageio</artifactId>
  <version>1.1</version>
  <type>pom</type>
</dependency>
I-yorn-man