JUnit测试无法正确加载fop 0.20.5所需的xercesImpl jar

问题描述 投票:0回答:1

等级依赖:

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:

文件:/ C:/用户/用户/.gradle/缓存/模块-2 /文件-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 intellij-idea java-8 apache-fop xerces
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.