Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including local jar file in project at build time using gradle

I want to include enterprise.jar file of salesforce in my project at build time using gradle Could anyone help me out how to include a local jar file that exists in src/main/resources folder in my project.

like image 647
Sonam Daultani Avatar asked Sep 25 '12 04:09

Sonam Daultani


People also ask

How can I create an executable Jar with dependencies using Gradle?

Right click the module > Open module settings > Artifacts > + > JAR > from modules with dependencies. Set the main class.

Where are jars stored in Gradle?

Gradle declares dependencies on JAR files inside your project's module_name /libs/ directory (because Gradle reads paths relative to the build.gradle file). This declares a dependency on version 12.3 of the "app-magic" library, inside the "com.example.android" namespace group.


1 Answers

This is explained in the documentation. The following should do:

dependencies {     compile files('./src/main/resources/enterprise.jar') } 

I wouldn't put the jar in src/main/resources though. It's not a resource of your project, but a compile dependency. I would put it in a lib directory.

like image 50
JB Nizet Avatar answered Sep 19 '22 18:09

JB Nizet