jmrah
jmrah

Reputation: 6222

Multiple Gradle Projects within one Eclipse Project - Refresh Dependencies

I have roughly this project structure in eclipse:

rootproj
---settings.gradle
---build.gradle

eclipseProject
---folderA
------build.gradle
---folderB
------build.gradle

I declare folderA and folderB as gradle projects in settings.gradle. folderA and folderB have a src/main/java with src files in them

Is there any way, in eclipse, I can right click on 'eclipseProject->gradle->refresh dependencies' and have folderA's and folderB's dependencies downloaded and added to 'eclipseProject's "Gradle Dependencies" folder?

Upvotes: 0

Views: 1744

Answers (2)

jmrah
jmrah

Reputation: 6222

This is the way I did it:

First, I needed to to make eclipseProject a gradle project by adding it to settings.gradle. Then I needed to add a build.gradle file to eclipseProject. And then in the build.gradle file in eclipseProject, I had to add these lines to configure the .classpath file that gets automatically generated when I right click eclipseProject->gradle->refresh dependencies:

eclipse.classpath.plusConfigurations += [
    project(':folderA').configurations.compile,
    project(':folderB').configurations.compile
]

Upvotes: 0

Klunk
Klunk

Reputation: 825

Do you import the projects individually or do you import the root project? Import the root project and you will get the sub projects listed individually.

Upvotes: 1

Related Questions