Include jar files in gradle project [duplicate]

2019-07-22 15:38发布

问题:

This question already has an answer here:

  • How to add local .jar file dependency to build.gradle file? 16 answers

I am trying to include a local jar file in my "Java" gradle project. I have added jar files in my "main/resource" folder of project. and in build.gradle added following lines :-

compile files('./src/main/resources/abc.jar')

It is not showing me any error at compile time. But when i run my project it is showing me following error:-

"Caused by: java.lang.NoClassDefFoundError: javax/json/Json"

回答1:

you need to add its dependency in gradle file.

compile fileTree(dir: 'libs', include: ['*.jar'])