【问题标题】:Adding itextg to gradle将 itextg 添加到 gradle
【发布时间】:2015-08-08 10:15:19
【问题描述】:

我想通过 gradle 添加 itextg 以避免维护一组库 jar。也许是我,但我在任何地方都找不到正确的 gradle compile 语句。

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:20.0.0'
    compile 'com.google.code.gson:gson:2.3.1'
    compile 'com.itextg:itextg:5.4.3'
}

常规的 itext 可以正常工作,但我正在尝试对图像进行处理。

compile 'com.itextpdf:itextpdf-5.5.6'

【问题讨论】:

    标签: android itext android-gradle-plugin itextg


    【解决方案1】:

    我认为这是因为我们在 Maven Central(Gradle 也用作存储库)上以 jar 的形式发布了 iText,并且还作为从各个站点的下载 (GitHub , 源锻);但 iTextG 只能在各种站点上下载,而不是在 Maven Central 上。 iTextG 使用与 iText 相同的命名空间:com.itextpdf:itextpdf,因此将它放在 Maven Central 上也会产生冲突。像com.itextg:itextg 这样的东西根本不存在(据我所知 - 我应该知道,因为我是 iText Software 的 QA 工程师)。 实际上,iText 和 iTextG 之间的主要区别在于,我们从 iTextG 中剥离了所有 AWT 依赖项。其余的它们是完全相同的代码库。

    因此,在了解了所有这些背景信息之后,要最终回答您的问题:您必须下载 iTextG jar 并手动将其添加到您的 libs 文件夹中。

    从 iText 5.5.9 开始,您可以将其添加到您的 Gradle 文件中:

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        compile 'com.android.support:appcompat-v7:20.0.0'
        compile 'com.google.code.gson:gson:2.3.1'
        compile 'com.itextpdf:itextg:5.5.9'
    }
    

    【讨论】:

    • 是的,这就是我所做的,虽然它不适合维护目的,但我推测在不久的将来没有计划改变它,所以我会处理它。谢谢!
    • 随时欢迎反馈! iTextG 不是一个单独的产品,它是 iText 的精简版(已删除 AWT 引用)。确实没有计划在 iText 5.x 中改变这一点
    • 您会很高兴听到我目前正在努力获得 iTextG 的 mavenized 版本。预计 5.5.9 版将于本月晚些时候发布。
    • 5.5.9 开始,您可以按照 OP 的预期使用 Gradle。有一个神器com.itextpdf:itextg:5.5.9。以前的版本不会上传到 Maven Central,因为我们还没有看到客户的具体要求。有关工件,请参阅 mvnrepository.com/artifact/com.itextpdf/itextg/5.5.9
    • 我尝试添加 5.5.11 但没有用,5.5.9 是。像魅力一样工作
    猜你喜欢
    • 1970-01-01
    • 2015-12-05
    • 2014-12-24
    • 1970-01-01
    • 2014-03-27
    • 2016-01-19
    • 2012-03-05
    • 2021-03-11
    • 2015-01-29
    相关资源
    最近更新 更多