Skip to content

Link IntelliJ modules to source sets instead of built jars - #258

Merged
labkey-adam merged 6 commits into
developfrom
fb_intellij_source_set_deps
Nov 24, 2026
Merged

labkey-adam merged 6 commits into
developfrom
fb_intellij_source_set_deps

Conversation

@labkey-adam

@labkey-adam labkey-adam commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Rationale

This makes IntelliJ resolve LabKey module classes to their source instead of to built jars, which broke find usages and navigation. Several source sets depended on their module's own jar/apiJar files, and the api and study jars packaged XMLBeans classes outside any source set; IntelliJ can't map either back to a source module, so it imported the jars as External Libraries.

Tested with a local 11.3.0-SNAPSHOT: after a Gradle sync, no module in the server enlistment references a built module jar except WNPRC's ApiKey and GoogleDrive, whose own build.gradle adds files(apiJar). Module jars contain the same files as before, the study module builds, and JSPs compile for core and query.

Related Pull Requests

Changes

  • Declare a module's dependencies on its own code (main, jsp, and IntelliJ-only spring source sets) as source set outputs instead of jar files
  • Package XMLBeans classes through the main source set output, which also keeps previous-compilation-data.bin out of module jars
  • Add 11.3.0 release notes

labkey-adam added a commit to LabKey/wnprc-modules that referenced this pull request Nov 22, 2026
…#1096)

## Rationale
This stops IntelliJ from resolving ApiKey and GoogleDrive API classes to
their built jars instead of source, which breaks find usages and
navigation. The LabKey Gradle plugin already adds each module's API to
its own classpath, so these explicit `files(apiJar)` dependencies are
redundant, and IntelliJ imports them as External Libraries.

Both modules compile, including GoogleDrive's JSPs.

## Related Pull Requests
- LabKey/gradlePlugin#258

## Changes
- Remove the explicit `files(apiJar)` dependency from ApiKey and
GoogleDrive

@labkey-tchad labkey-tchad left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me but Claude has thoughts:

No blocking issues. Module jars still include the XMLBeans classes through main.output, the task dependencies are unchanged, and there are no new dependency cycles. Three nits:

  1. Jsp.groovy (addJspTasks): jsp2Java still has dependsOn('apiJar') and dependsOn('jar'). The JSP classpath now gets these task dependencies from the source set outputs, so every JSP compile still builds both jars for no reason. Could these two lines be removed, or is there a reason they're still needed?
  2. JavaModule.groovy:117: sourceSets.main.output.dir(...) for build/xb is registered inside the jar {} configure block. That block runs right away today, but if jar setup ever becomes lazy (tasks.named('jar').configure), then IntelliJ syncs and JSP compiles that never trigger the jar task would lose the XMLBeans classes. Consider moving the call into addSourceSets, next to the existing XmlBeans srcDirs setup.
  3. JavaModule.groovy:117: build/xb is now both a main Java source root and a main output dir. It's worth a Gradle sync on a module with schemas (e.g. study) to confirm IntelliJ doesn't flag or exclude the overlapping root. If the srcDirs entry was only there to expose the classes, it could go now.

@labkey-adam

Copy link
Copy Markdown
Contributor Author

Thanks! Addressed in 31aea0c:

  1. Removed jsp2Java's dependsOn('apiJar') and dependsOn('jar'). jspCompileClasspath now carries those task dependencies through the source set outputs.
  2. Moved the XMLBeans compileJava.dependsOn and main.output.dir(...) out of the jar {} block into addSourceSets.
  3. I synced study after the change. IntelliJ keeps build/xb as a source folder and doesn't flag or exclude anything. The srcDirs entry is probably unnecessary now, since that directory holds no .java files. It predates this PR, though, and removing it changes the IntelliJ model, so I'd rather do it in a separate change.

Rerunning the verify, BVT, and installer builds on the server test branch now.

@labkey-adam
labkey-adam merged commit 49f0a01 into develop Nov 24, 2026
3 checks passed
@labkey-adam
labkey-adam deleted the fb_intellij_source_set_deps branch November 24, 2026 03:57
labkey-adam added a commit to LabKey/server that referenced this pull request Nov 24, 2026
## Rationale
Use the latest published version, which fixes several navigation and
find-usages issues in IntelliJ

## Related Pull Requests
- LabKey/gradlePlugin#258
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants