问题描述
非常繁琐,涉及多个罐子和环境变量。如果我可以将它添加为常规的Maven依赖项,它将有助于项目的可移植性。
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.
我正在使用的POM片段是
The POM snippet I'm using is
<dependency>
<groupId>com.sun.media</groupId>
<artifactId>jai_imageio</artifactId>
<version>1.1</version>
</dependency>
且错误是
[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需要两个罐子;
- jai_imageio需要一个本地库已安装和要设置的两个环境变量。
我还没有找到一种方法让这个与Maven一起工作。
I have not found a way to make this work with Maven.
请参阅阅读JCS_YCCK图像。
See Reading JCS_YCCK images using ImageIO for the reason I'm using JAI.
推荐答案
我没看到的是那个JAI依赖关系只需要在运行时满足,因此我确保生产环境可以通过为Tomcat配置来访问JAI。
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.
这篇关于在Maven中使用Java Advanced Imaging的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!