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

JUnit test cannot properly load xercesImpl jar that is required by fop 0.20.5

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。代码使用classorg.apache.fop.apps.Driver。 jar lib实际路径是

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

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