【问题标题】:JUnit test cannot properly load xercesImpl jar that is required by fop 0.20.5JUnit 测试无法正确加载 fop 0.20.5 所需的 xercesImpl jar
【发布时间】:2019-11-27 12:25:40
【问题描述】:

Gradle 依赖项:

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    compileOnly 'org.projectlombok:lombok:1.18.4'
    compile group: 'commons-io', name: 'commons-io', version: '2.6'
    compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'

    //compile group:'net.sf.barcode4j', name: 'barcode4j-fop-ext', version: '2.1'

    // logging
    compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.12.1'
    compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.12.1'
    // FOP 1.1 & SAXON
    compile group:'org.apache.xmlgraphics', name: 'fop', version: '1.1'
//  compile group:'org.apache.xmlgraphics', name: 'fop-patched', version: '1.1'
    compile "org.apache.servicemix.bundles:org.apache.servicemix.bundles.saxon:9.5.1-5_1"

    // FOP » 0.20.5
    compile group:'fop', name: 'fop', version: '0.20.5'
    compile group: 'org.apache.avalon.framework', name: 'avalon-framework-impl', version: '4.3.1'
    compile group:'batik', name: 'batik-1.5-fop', version: '0.20-5'
    compile group: 'xalan', name: 'xalan', version: '2.4.1'
    compile group: 'xerces', name: 'xercesImpl', version: '2.2.1'
    compile group: 'xml-apis', name: 'xml-apis', version: '1.0.b2'

    testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.2.1.RELEASE'
    testCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
}

FileNotFoundException:

file:/C:/Users/user/.gradle/caches/modules-2/files-2.1/fop/fop/0.20.5/ffa9d8eb84897746aa196d3f3336d034ddb26f59/xercesImpl-2.2.1.jar

fop jar 确实没有 xercesImpl-2.2.1.jar。代码使用类org.apache.fop.apps.Driver。 jar lib实际路径是

\.gradle\caches\modules-2\files-2.1\xerces\xercesImpl\2.2.1\a6d76534ef05c5f1a6ed8ed7556010e0cb41244e

【问题讨论】:

  • 您是否尝试升级 Gradle?

标签: gradle intellij-idea java-8 apache-fop xerces


【解决方案1】:

将项目拆分为不同的模块解决了这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-04-07
    • 2019-11-23
    • 2019-01-30
    • 2018-06-19
    • 1970-01-01
    • 1970-01-01
    • 2013-08-24
    相关资源
    最近更新 更多