Gradle Isolated Projects Incompatibility
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 317
- Forks
- 76
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 5
Description
When you try to enable Isolated Projects in paperweight project (paperweight-userdev plugin), you catch such error:
org.gradle.api.InvalidUserCodeException: Cannot call 'getByName(String)' on BuildServicesRegistry.getRegistrations()
when Isolated Projects is enabled. Only 'findByName(String)' is permitted. Alternatively, use
BuildServicesRegistry.registerIfAbsent(String, Class) if possible.
Gradle 10 enables configuration cache by default (and paperweight already supports this) and then (in future releases) enables Isolated Projects which would speed up build for multi-model projects in configuration stage by many times.
Here's my settings to reproduce this:
Environment
- Gradle 9.7.0
io.papermc.paperweight.userdev2.0.0-beta.21- Kotlin 2.2.0, JVM 21 toolchain
org.gradle.configuration-cache=truealready enabled and working;org.gradle.isolated-projects=trueis what we're trying to turn on- ~110 total modules count and ~30 with paperweight
Reproduction
- Apply
io.papermc.paperweight.userdevto any project. - Set
org.gradle.isolated-projects=true. - Run any task that configures that project, e.g.
./gradlew help.
Root cause
Full stack trace from the configuration-cache problems report:
org.gradle.api.InvalidUserCodeException: Cannot call 'getByName(String)' on BuildServicesRegistry.getRegistrations()
when Isolated Projects is enabled. Only 'findByName(String)' is permitted. Alternatively, use
BuildServicesRegistry.registerIfAbsent(String, Class) if possible.
at org.gradle.api.internal.DelegatingNamedDomainObjectSet.getByName(DelegatingNamedDomainObjectSet.java:145)
at io.papermc.paperweight.util.UtilsKt.getDownload(utils.kt:115)
at io.papermc.paperweight.userdev.PaperweightUser$createSetup$ret$1$1.execute(PaperweightUser.kt:378)
at io.papermc.paperweight.userdev.PaperweightUser$createSetup$ret$1$1.execute(PaperweightUser.kt:376)
at io.papermc.paperweight.userdev.PaperweightUser$createSetup$ret$1.execute(PaperweightUser.kt:376)
at io.papermc.paperweight.userdev.PaperweightUser$createSetup$ret$1.execute(PaperweightUser.kt:375)
at io.papermc.paperweight.userdev.PaperweightUser.createSetup(PaperweightUser.kt:413)
at io.papermc.paperweight.userdev.PaperweightUser.apply$lambda$3(PaperweightUser.kt:101)
UtilsKt.getDownload() (utils.kt:115) looks up an existing shared BuildService registration via project.gradle.sharedServices.registrations.getByName(name) instead of findByName(name) or registerIfAbsent(name, Class). Under IP, BuildServicesRegistry.getRegistrations() only permits findByName; getByName is explicitly disallowed because it materializes/queries a registration in a way IP can't isolate across projects. This path runs for every project PaperweightUser (i.e. the paperweight-userdev plugin) is applied to, in PaperweightUser.apply() → createSetup() → the download shared-service lookup — so it reproduces identically on any Bukkit module in a multi-module build that uses this plugin, not just ours.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at UtilsKt.getDownload in utils.kt:115 and trace the shared BuildService lookup from PaperweightUser.kt:375-413. Reproduce with Gradle 9.7, isolated projects enabled, and ./gradlew help. Done means the paperweight-userdev plugin configures without the InvalidUserCodeException under isolated projects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100