DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • How to Build Your Own AI SRE From Scratch
  • Stop Preparing for Audits — Build the Pipeline That Audits Itself
  • Multi-Agent Software Engineering: Can AI Teams Build Production Systems?
  • Arm64 Is No Longer the Edge Case

Trending

  • When a Coding Agent Fixes the Test Instead of the Bug
  • Introduction to Error Prone: How to Catch Bugs at Compile Time
  • Architecture Review Boards for Generative AI: A Framework for Governance, Risk Management, and Responsible Adoption
  • The SDLC After AI

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Coding
  3. Tools
  4. Composite Builds With Gradle and IntelliJ IDEA

Composite Builds With Gradle and IntelliJ IDEA

One of the new features in IntelliJ IDEA 2017.1 is full support for Gradle Composite Builds. See what they are, how they work, and why you might want to use them.

By 
Trisha Gee
·
Mar. 21, 17 · Presentation
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
21.5K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

One of the new features in IntelliJ IDEA 2017.1 is full support for Gradle Composite Builds. We were fortunate to have Stefan Oehme from Gradle presenting a webinar, showing what composite builds are, how they work and why you might want to use them. In the second part of the webinar, I (Trisha Gee) cover the support for Gradle composite builds in IntelliJ IDEA 2017.1. Take a look at the end of this post for the full video.

Support for composite builds was first introduced in IntelliJ IDEA 2016.3. With this, you had the ability to add additional Gradle builds to your project, and configure them as a dependency for your composite build.  You can see this functionality at the start of the section showing the IntelliJ IDEA features, but let’s take a quick refresher course in what Gradle Composite Builds are.

Imagine you have a project set up to be dependent upon some libraries:

Application dependent upon libraries

You may have access to the source code for this library, and even be able to make changes and commit them, but this traditionally required you to use a different IntelliJ IDEA project to make the changes, then build it and somehow deploy the updated library. But now with Gradle’s Composite Builds, you can easily update and test the library code. All you need to do is to change settings.gradle to include the location of the build for the library code.

Include build in settings.gradle

Now Gradle is using composite builds, i.e. it can build multiple independent projects together. IntelliJ IDEA recognizes this, and as you can see from the screenshot above, it not only updates the Gradle window to reflect the multiple builds, but imports the code for the included build as an additional IntelliJ IDEA module.

Stefan talked about the use cases that really benefit from using Gradle’s composite builds. Composite build support in IntelliJ IDEA means you can work very naturally with code from other libraries, modules, or plugins you may be dependent upon. You can make changes to the library code, and even commit these changes to the library’s own repository.

If your projects are already using composite builds, IntelliJ IDEA has full support for importing, building and running these projects.  The behavior inside the IDE is what you would expect, you get the included Gradle builds imported as IntelliJ IDEA modules.

For example, if you import a Gradle project that depends on included builds (like the one defined in the composite folder in this sample), the Gradle included builds will be identified and imported as IntelliJ IDEA modules, so you can work with all of the code that makes up the composite build, as if it were a single project.

Another use case for composite builds is to bundle together projects, possibly from different repositories, that are effectively separate modules that work together.  This use case may be particularly useful if your team is moving from a single repo “monolith” type of application to something that’s made up of independent modules or services. Gradle lets you include the builds for all the different modules (see the settings.gradle in this sample code for an example) into a composite build, and IntelliJ IDEA will find all those Gradle projects and treat them as IntelliJ IDEA modules.

The final example shown in the webinar is how valuable composite builds can be for Gradle plugin developers. Whether you’re developing a plugin and have an example project that uses the plugin to test it, or whether you’re working on an application that uses a plugin that you may want to experiment with, you can create a project from the “consumer” of the plugin (like in this sample code) and see the plugin code also imported as an IntelliJ IDEA module.

In summary, you’ll see that if you’re using composite builds with Gradle, IntelliJ IDEA will figure out the right project and module structure for you to be able to work naturally with the builds you’ve included, with the ability to see the code for the included projects, navigate to it, use refactoring and everything else works as if you were working with an ordinary IntelliJ IDEA module.

See the webinar in its full glory here.

intellij Build (game engine) Gradle

Published at DZone with permission of Trisha Gee. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • How to Build Your Own AI SRE From Scratch
  • Stop Preparing for Audits — Build the Pipeline That Audits Itself
  • Multi-Agent Software Engineering: Can AI Teams Build Production Systems?
  • Arm64 Is No Longer the Edge Case

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook