Srikanth
Srikanth

Reputation: 580

Gradle other project as dependency in eclipse

I have a web application which depends on another standalone project. Simply the web project requires a standalone project jar to be in classpath. I have built the standalone project jar with gradle and included that in web application's WEB-INF/lib folder. The project is running as expected. Now i want to make it automatic by adding that project as dependency. This is also achieved using the following code.

settings.gralde

include 'job-invoker'
project(':job-invoker').projectDir = new File(settingsDir, '../job-invoker')

build.gradle

dependencies {
   compile project(':job-invoker')
   .
   .
}

I'm able to build the war file from command line using gradle and run it in tomcat. But i'm getting errors in eclipse. I'm not able to run the project in eclipse due to the compilation errors. Can some one please help me. Thanks in advance.

Upvotes: 1

Views: 1134

Answers (1)

Srikanth
Srikanth

Reputation: 580

Finally i found a solution for this by installing the other project in maven local repository and adding this as a regular dependency in project. Reference code is given below.

Other project Gradle file

apply plugin: 'maven'
group = 'com.xxx.job'
version = '1.0'

Run gradle install command on this project. Then add mavenLocal() to your repositories in another project and add the dependency

compile 'com.xxx.job:job-invoker:1.0'

Upvotes: 1

Related Questions