'commons-vfs2',没有被添加到 fatJar 中。
代码在 Intellij 上运行时有效。当我创建一个 fatJar 时,我找不到异常类。
线程“主”java.lang.NoClassDefFoundError 中的异常:org/apache/commons/vfs2/UserAuthenticator
Gradle 文件依赖项
dependencies {
// This dependency is used by the application.
implementation 'com.google.guava:guava:27.1-jre'
// Use TestNG framework, also requires calling test.useTestNG() below
testImplementation 'org.testng:testng:6.14.3'
compile group: 'commons-logging', name: 'commons-logging', version: '1.2'
compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.3.2'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.3.4'
compile 'com.google.guava:guava:21.0'
compile group: 'org.json', name: 'json', version: '20090211'
compile 'com.aventstack:extentreports:3.0.6'
compile group: 'org.testng', name: 'testng', version: '6.10'
compile group: 'javax.mail', name: 'mail', version: '1.4'
// https://mvnrepository.com/artifact/com.jcraft/jsch
compile group: 'com.jcraft', name: 'jsch', version: '0.1.54'
runtime fileTree(dir: 'src/main/resources', includes: ['src/main/conf.properties'])
// https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client
compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '1.1.7'
// https://mvnrepository.com/artifact/com.jayway.jsonpath/json-path
compile group: 'com.jayway.jsonpath', name: 'json-path', version: '2.4.0'
// https://mvnrepository.com/artifact/com.google.code.gson/gson
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
// https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.11.0'
// https://mvnrepository.com/artifact/postgresql/postgresql
compile group: 'postgresql', name: 'postgresql', version: '9.1-901-1.jdbc4'
// https://mvnrepository.com/artifact/log4j/log4j
//compile group: 'log4j', name: 'log4j', version: '1.2.16'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.11.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.11.2'
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl
compile group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.11.2'
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.19'
compile group: 'com.jayway.jsonpath', name: 'json-path', version: '2.4.0'
compile("io.github.bonigarcia:webdrivermanager:4.2.2")
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
implementation 'org.apache.poi:poi:4.0.0'
implementation 'org.apache.poi:poi-ooxml:4.0.0'
implementation group: 'org.apache.commons', name: 'commons-vfs2', version: '2.0'
}