我已经在以下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?
任何帮助将不胜感激。谢谢。