Hi there. Seeing an issue with composite builds i...
# community-support
j
Hi there. Seeing an issue with composite builds in intellij since upgrading to gradle 8. My project has both a
buildSrc
project and an "external" build which creates some gradle plugins. It used to be that I could enable Composite Build in the intellij UI, and then it would resolve my plugin classes back to source when navigating from buildscripts (very nice!) ...but, since upgrading to gradle 8, it seems that my
buildSrc
is always listed as a composite, which prevents intellij from showing the option to enable composites (if I enable composites in settings.gradle, the gui option is normally removed, but it also doesn't work properly in IDE). So, does anyone have any ideas or suggests? gpt suggested removing
buildSrc/settings.gradle
but that didn't help, and manually printing the included builds shows nothing. I'll attach the xml I pulled from
.idea/gradle.xml
in a thread, in case it helps.
Copy code
<compositeConfiguration>
          <compositeBuild compositeDefinitionSource="SCRIPT">
            <builds>
              <build path="$PROJECT_DIR$/buildSrc" name="buildSrc">
                <projects>
                  <project path="$PROJECT_DIR$/buildSrc" />
                </projects>
              </build>
            </builds>
          </compositeBuild>
        </compositeConfiguration>
v
I usually define my composite builds in the settings script, not in the IDE and never had problems. But I also for ages don't use
buildSrc
anymore, but a proper composite build for build logic. But anyway, if you can only define one composite build in IDE and not multiple, I'd say that is an IDE bug.
j
well, "never had problems" -> are you getting "jump to definition" (ctrl+b on linux) going to sources or compiled classes? Whenever I set the composite in gradle buildscript, I usually wind up getting sent to compiled class files, when I want to jump to source. Maybe I'm doing something else wrong if "includeBuild() in settings.gradle" gives the premium 'link to source' behavior for others...
v
Of course to sources. That's one of the main use-cases for composite builds, that you have both projects open on the same IDE and can develop them together further even if they are released separately and normally used via binary dependency
t
@JamesX I use intellij and gradle 8 and for me me it mostly "just works". So if you use includeBuild('') in your settings and sync you are getting codehighlighting out of the box without any further setup. However intellij has a bunch of bugs which may or may not apply to your specific setup. Sometimes intellijs caches even go completly haywire the only thing that can fix it is a new working copy
v
IJ also gets its caches corrupted without using composite builds occasionally. Latest when you do "Invalidate Caches and Restart" they are fine again though. Sometimes also a "Sync Gradle Project" or "Rebuild Project" is enough, or "Repair IDE on file" for a specific file.