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
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

SBOMs are essential to circumventing software supply chain attacks, and they provide visibility into various software components.

Related

  • How to Build Real-Time BI Systems: Architecture, Code, and Best Practices
  • How To Build Resilient Microservices Using Circuit Breakers and Retries: A Developer’s Guide To Surviving
  • Accelerating Debugging in Integration Testing: An Efficient Search-Based Workflow for Impact Localization
  • Introduce a New API Quickly Using Spring Boot and Gradle

Trending

  • Modernizing Apache Spark Applications With GenAI: Migrating From Java to Scala
  • Are Traditional Data Warehouses Being Devoured by Agentic AI?
  • Top Load Balancing Algorithms: Choosing the Right Strategy
  • The Shift to Open Industrial IoT Architectures With Data Streaming
  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 user avatar
Trisha Gee
·
Mar. 21, 17 · Presentation
Likes (6)
Comment
Save
Tweet
Share
20.9K Views

Join the DZone community and get the full member experience.

Join For Free

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, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • How to Build Real-Time BI Systems: Architecture, Code, and Best Practices
  • How To Build Resilient Microservices Using Circuit Breakers and Retries: A Developer’s Guide To Surviving
  • Accelerating Debugging in Integration Testing: An Efficient Search-Based Workflow for Impact Localization
  • Introduce a New API Quickly Using Spring Boot and Gradle

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

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 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: