Adam
Adam

Reputation: 163

Intellij IDEA With Multiple Gradle Projects

I am working on two Gradle projects. One of these projects is a supporting library that will be used by other projects in the future so project A depends on project B but not as a 'multi module project'. The dependency is to be resolved through the artifact repo so project a declares it as a compile dependency using it's maven coordinates.

My problem is when working on these two projects in IntelliJ changes to project B aren't made available to project A until I install it (using the Gradle Maven plugin) in my local repo. This is kind of annoying and slows down my workflow. Is there a way to get IntelliJ to automatically update the dependency internally?

Upvotes: 3

Views: 3633

Answers (2)

Giovanni Toraldo
Giovanni Toraldo

Reputation: 206

In IDEA 2017 you can right-click on the gradle module and use Composite Build Configuration to link the current module to one or more gradle module already opened in the current workspace.

Upvotes: 0

gregwhitaker
gregwhitaker

Reputation: 13410

This is supported in the latest versions of Gradle and IntelliJ. It is known as a Composite Build.

Composite builds can be declared in the project's settings.gradle file as follows:

includeBuild '../my-app'

or by using the --include-build command line argument:

$ gradle --include-build ../my-utils run

Take a look at the Composite Builds with Gradle and IntelliJ IDEA Webinar for instructions on how to configure the integration.

Upvotes: 10

Related Questions