# Setting up composite builds in IntelliJ

**URL:** <https://openrndr.discourse.group/t/setting-up-composite-builds-in-intellij/81>\
**Category:** Tutorials\
**Created:** [April 9, 2020, 9:57am UTC](https://openrndr.discourse.group/t/setting-up-composite-builds-in-intellij/81 "2020-04-09T09:57:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![edwin](https://avatars.discourse-cdn.com/v4/letter/e/73ab20/32.png) [@edwin](https://openrndr.discourse.group/u/edwin)\
**Post date:** [April 9, 2020, 9:57am UTC](https://openrndr.discourse.group/t/setting-up-composite-builds-in-intellij/81/1 "2020-04-09T09:57:10Z")

</div>

This is a tutorial on setting up IntelliJ in such a way that it treats OPENRNDR, ORX and your template based work as a single inter-dependent project. This is useful in cases in which you want to make changes to OPENRND and ORX and be able to see their effect in your work immediately. Here immediately means without having to go through the process of running `gradle publishToMavenLocal -Prelease.version=0.4.0-SNAPSHOT`. Composite projects are also convenient when you work with the debugger and want to set breakpoints inside OPENRNDR or ORX.

# Step 1: clone repositories

```auto
mkdir composite
cd composite
git clone https://github.com/openrndr/openrndr
git clone https://github.com/openrndr/orx
git clone https://github.com/openrndr/openrndr-template

```

Note here that I make folder called `composite` here, this will function as the top-level project in IntelliJ IDEA. You can pick whatever name you like for it.

# Step 2: start IntelliJ IDEA

From terminal (but possible in other ways too), start IntelliJ. IntelliJ will treat our `compsite` folder as a project. You probably need to install IntelliJ command-line tools for this work.

```auto
idea

```

# Step 3: Import gradle projects

For each of the modules `openrndr` , `openrndr-template` , and `orx` locate the build.gradle or build.gradle.kts files and use “Import Gradle Project” on them.

 ![Screenshot from 2020-04-09 10-55-13](https://global.discourse-cdn.com/free1/uploads/openrndr/original/1X/2c3b3d409e38ce5b9301d77ebd1eda1730467424.png)

# Step 4: Configure composite builds

- Open the Gradle view on the right.
- Right click on `openrndr-template` and open “Composite Build Configuration”. Check both `openrndr` and `orx` .
- Right click on `orx` and open “Composite Build Configuration”, check only `openrndr`

 ![composite-03](https://global.discourse-cdn.com/free1/uploads/openrndr/original/1X/cd83e1e45c3e579a76baa682812fc1faf92c6993.png)

![composite-04](https://global.discourse-cdn.com/free1/uploads/openrndr/original/1X/791f2756e47ecf6001d95cbcbba790be266a0326.png)

# Step 5: Fix openrndr-template

I suspect this is an IntelliJ bug. In build.gradle.kts we have to change the line  
`runtimeOnly(openrndr("gl3"))` to `implementation(openrndr("gl3"))` otherwise the GL3 back-end cannot be resolved (for reasons unclear to me)

# Step 6: Fix run configuration

When IntelliJ launches programs it will set the CWD to composite, so you will have to change the working directory to `composite/openrndr-template`

 ![Screenshot from 2020-04-09 11-05-25](https://global.discourse-cdn.com/free1/uploads/openrndr/original/1X/8823b820a76458eaadd0c0c4c24cd5d0149342ac.png)

That’s it. You should be able to run the template program while linking against the OPENRNDR and ORX versions in your composite project.

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [April 9, 2020, 1:16pm UTC](https://openrndr.discourse.group/t/setting-up-composite-builds-in-intellij/81/2 "2020-04-09T13:16:41Z")

</div>

Idea for the second part of this tutorial: How to contribute to OPENRNDR 🙂

It would include forking `openrndr`, `orx` and `openrndr-template`, cloning those instead of the official, creating a branch to prepare a pull request, making changes, maybe a demo, tests, pushing your changes, sending a PR, then deleting the branches, and how to keep your local repo up to date, how to avoid messy PRs… (or links to some docs about these issues)

---

<div class="post-metadata">

**Author:** ![edwin](https://avatars.discourse-cdn.com/v4/letter/e/73ab20/32.png) [@edwin](https://openrndr.discourse.group/u/edwin)\
**Post date:** [April 11, 2020, 6:17am UTC](https://openrndr.discourse.group/t/setting-up-composite-builds-in-intellij/81/3 "2020-04-11T06:17:04Z")

</div>

After upgrading to IntelliJ 2020.1 I noticed that composite builds do not work so well anymore.

I will try to find some time to report it in IJ bugtracker, but the number of known bugs that touch composite gradle builds is a bit overwhelming though.
