I'm wanting to make an executable file that will automatically create a Google Task list with associated tasks.
Right now, however, I'm trying to simply create an executable using the default code that Google provides here. Once you add the credentials.json
file (explained below) and enter gradle run
(in the repo I've provided) in a terminal/cmd, it will work as expectedly.
However, if you run gradle jar
to create a jar, you will get this error when you try to run the jar:
java.lang.NoClassDefFoundError: com/google/api/client/json/JsonFactory
Download and replace the credentials.json
file located in ./src/main/resources/
by clicking the "ENABLE THE GOOGLE TASKS API" on this page.
gradle run
Inside the project's root, enter grade jar
. This will create a jar in the ./src/build/libs/
folder
./src/build/libs/
folder, run java -jar demo-1.0.jar
At this point, you will get the error mentioned above.
It seems that you want what's known as an "uber" jar (a jar that also contains its dependencies)
You can do this by
jar {
from configurations.runtime.collect { zipTree(it) }
}