【发布时间】:2015-12-01 16:36:21
【问题描述】:
我有一个项目需要依赖于 iText 5.5.2 和 iText 2.1.7(Primefaces 在运行时需要此特定版本,并且由于许可证问题而无法与 iText 5 一起使用)。
所以我的 pom.xml 中有这个:
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.2</version>
<scope>compile</scope>
</dependency>
<!-- iText 2.1.7 is necessary at runtime to have the 'Export to PDF' function of Primeface work -->
<!-- It won't conflict with iText 5 as the packages are different -->
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
<scope>runtime</scope>
</dependency>
问题是我不希望我们的开发人员能够从 iText 2.1.7(com.lowagie.* 包)导入类。我想强制他们使用 iText 5.5.2(com.itextpdf.* 包)中的类。
虽然 iText 2.1.7 处于“运行时”范围内,但 Eclipse 仍然在构建路径中添加 jar 文件,允许开发人员导入错误的包(com.lowagie 而不是 com.itextpdf)。
有没有办法从构建路径中排除它?
【问题讨论】:
-
我更新了我的答案,使用配置文件的技巧很有效。希望能帮到你
标签: java eclipse maven primefaces itext