some problems with java and slf4j Made project using idea and it is ok. But in case I try to make jar with gradle I have some problems.
build.gradle
JVM cannot find dependencies on classpath because they're not on classpath obviously. By default Gradle and Maven add just your classes to a jar and you have to specify paths to the dependencies manually with the -cp
argument. If you want to build a fat jar you can use ShadowJar with Gradle and Shade with Maven.
dependencies {
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
testCompile group: 'junit', name: 'junit', version: '4.+'
compile 'ch.qos.logback:logback-core:1.1.6'
compile 'ch.qos.logback:logback-classic:1.1.6'
compile 'org.slf4j:slf4j-api:1.7.18'
}
Thanks Michael for remembering about fat jar. After your comment tried to google: "gradle build fat jar" and after it modified my build.gradle
jar {
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
}
manifest {
attributes 'Main-Class': 'Test'
}
}