この次の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?
どんな助けでも大歓迎です。ありがとう。