0

我已经用下面的 build.gradle 构建了一个 jar。

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
    }
}

apply plugin: 'com.github.johnrengelman.plugin-shadow'
apply plugin: 'java'
apply plugin: 'application'

group 'Main'
version '1.0'

sourceCompatibility = 1.8

repositories {
    jcenter()
}

dependencies {
    testCompile 'junit:junit:4.12'
}
mainClassName = "Indexer"

dependencies {
    compile 'org.apache.lucene:lucene-core:7.4.0'
    compile 'org.apache.lucene:lucene-queryparser:7.4.0'
    compile 'org.apache.lucene:lucene-analyzers-common:7.4.0'
    compile 'org.apache.lucene:lucene-backward-codecs:7.4.0'
    compile 'org.apache.poi:poi:3.9'
    compile 'org.apache.poi:poi-ooxml:3.9'

}

shadowJar {
    manifest {
        attributes 'Main-Class': 'Indexer'
    }
    mergeServiceFiles()
}

从 IDE 运行正常(IntelliJ)。使用命令 shadowJar 生成 jar 后,它显示此错误:

Warning: Caught exception attempting to use SAX to load a SAX XMLReader 
Warning: Exception was: shadow.org.xml.sax.SAXException: Can't create default XMLReader;
 is system property org.xml.sax.driver set?
Warning: I will print the stack trace then carry on using the default SAX parser
shadow.org.xml.sax.SAXException: Can't create default XMLReader; 
 is system property org.xml.sax.driver set?

任何帮助将不胜感激。谢谢。

4

0 回答 0