I was facing similar issues using a simple gradle configuration as follows
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.2.0'
compile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.23.1'
}
jar {
manifest {
attributes 'Main-Class': 'rewards.simulator.MainSimulator'
}
}
I later found that gradle build was creating a jar which was not including any external dependencies. Following configuration is to be used to include all your dependent libraries in the resulting jar file, along with your source files, to create a fat-jar:
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.2.0'
compile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.23.1'
}
jar {
manifest {
attributes 'Main-Class': 'rewards.simulator.MainSimulator'
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}