Hello) I’ve started to learn gradle two days ago. I’ve read some articles and several chapters in Gradle Guide. But when I tried to implement a tutorial project from http://spring.io/guides/gs/gradle/ I’ve got some complications. The problem is that I don’t know how to add dependencies so that they are available in runtime. At this point when I’am running the main class of that project I’am getting a NoClassDefFoundError indicating that the class I’ve used from that library is not available due to some reasons. Maybe the tutorial is only about to compile the project and it’s not supposed to be run. But I still need to figure it out. I’ve also created a Gradle project in NetBeans (it uses Spring Boot) it works within the IDE, but I still cant run it outside one.
So the main question is that: How can I compose build.gradle file so that the output classes and jars can access the external libraries (jars in particular)?
Exception in thread "main" java.lang.NoClassDefFoundError: org/joda/time/LocalTime at hello.HelloWorld.main(HelloWorld.java:7) Caused by: java.lang.ClassNotFoundException: org.joda.time.LocalTime at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 1 more
Thank You)) P.S. Sorry for such a tedious explanations))