Slackbot
07/27/2023, 6:23 PMChris Lee
07/27/2023, 6:27 PMimplementation or api. compileOnly would not be there and would result in what you are seeing.Kelvin Chung
07/27/2023, 6:28 PMimplementation, which is why it is so baffling.Vampire
07/27/2023, 7:29 PMbuildSrc? Can you show an MCVE that shows the problem?Kelvin Chung
07/27/2023, 8:30 PMChris Lee
07/27/2023, 8:31 PMKelvin Chung
07/27/2023, 8:32 PMKelvin Chung
07/27/2023, 8:32 PMChris Lee
07/27/2023, 8:38 PMChris Lee
07/27/2023, 8:39 PMplugins block or otherwise? Are you referencing it in buildscript?Kelvin Chung
07/27/2023, 8:39 PMChris Lee
07/27/2023, 8:40 PMKelvin Chung
07/27/2023, 8:41 PMruntime in the pom, which is probably the issue.Kelvin Chung
07/27/2023, 8:41 PMChris Lee
07/27/2023, 8:45 PMruntime is fine, it pulls in those deps to execute it.
Doesn’t look like the issue is there.
Perhaps there are conflicting libraries between plugins, that can cause ClassNotFound errors.
Run a build scan, check the build dependencies, ensure the deps you expect are there at the right version.Kelvin Chung
07/27/2023, 8:52 PMChris Lee
07/27/2023, 8:59 PMKelvin Chung
07/27/2023, 9:12 PMbuildEnvironment would fail.
If it makes any difference, I do see this in cases where apply(false) is present and not present in the plugins block.Chris Lee
07/27/2023, 9:13 PMKelvin Chung
07/27/2023, 9:14 PMapply(false) isn't present as well.Chris Lee
07/27/2023, 9:14 PMChris Lee
07/27/2023, 9:15 PMKelvin Chung
07/27/2023, 9:17 PMapply(false) is usually present due to its necessity in a supporting script plugin, which does raise this issue. If it's down to that, then it would make sense.Kelvin Chung
07/27/2023, 9:17 PMKelvin Chung
07/27/2023, 10:15 PMbuild.gradle.kts so that I can apply the plugin without using apply(false), the problem persists in that the third-party library is still not present in the buildscript classpath.
Would the project structure of the plugin repo be a factor? I have, in the plugin repo
root/
library/
settings.gradle.kts
plugin/
settings.gradle.kts
build.gradle.kts
settings.gradle.kts
The plugin/settings.gradle.kts does have includeBuild("../library"), and the root settings.gradle.kts has includeBuild("library") pointing to the same place, mainly so that library and plugin are built and published together.Kelvin Chung
07/27/2023, 10:26 PMbuildEnvironment can run properly, I get this:
+--- my-plugin:my-plugin.gradle-plugin:1.0.0
| \--- com.mycom:my-plugin:1.0.0
and nothing else - no reference to the library that was declared as api or implementation in the plugin's own build.gradle.kts. That seems odd.Chris Lee
07/27/2023, 10:51 PMKelvin Chung
07/27/2023, 10:51 PMKelvin Chung
07/27/2023, 10:52 PM:publish in my plugin repo, then both the library and the plugin is published. ie.
tasks.register("publish") {
dependsOn(gradle.includedBuild("library").task(":publish"))
dependsOn(gradle.includedBuild("plugin").task(":publish"))
}
is in my root build file.Chris Lee
07/27/2023, 10:53 PMKelvin Chung
07/27/2023, 10:55 PMdependencies {
implementation("com.mycom:my-library")
}
No version specified, though that shouldn't be relevant - I see this issue if this was a public third-party dependency like Guava as well.Chris Lee
07/27/2023, 10:56 PMKelvin Chung
07/27/2023, 10:56 PMChris Lee
07/27/2023, 10:58 PMbuildEnvironment that shows that things clearly aren’t right.
Are you able to further boil this down to a simple reproducer?Kelvin Chung
07/27/2023, 11:01 PMKelvin Chung
07/27/2023, 11:35 PMlibrary, plugin, and smoke. Running :smoke:buildEnvironment shows that library and the external dep (Guava) shows up normally, but if I were to publish library and plugin, and have a different project apply plugin, then library and the external dep disappears.
I'm still missing the information about publishing externally, of course.Vampire
07/27/2023, 11:57 PMKelvin Chung
07/27/2023, 11:58 PMVampire
07/28/2023, 12:01 AMKelvin Chung
07/28/2023, 12:11 AM"variants" [{
"name": "apiElements",
"attributes": {...},
"files": [...],
}, {
"name": "runtimeElements",
"attributes": {...},
"dependencies": [{
"group": "com.kelvSYC",
"module": "my-library",
"version": {
"requires": "1.0.0"
}
}],
"files": [{ ... }]
}]
Nothing out of the ordinary other than something appearing as apiElements because it was declared as an api dependency. And nothing to suggest that applying in shouldn't bring its dependencies into the buildscript classpath.Chris Lee
07/28/2023, 12:23 AMKelvin Chung
07/28/2023, 12:34 AM"dependencies": [{
"group": "com.kelvSYC.internal",
"module": "platform",
"version": {
"requires": "unspecified"
},
"attributes": {
"org.gradle.category": "platform"
},
"endorseStrictVersions": true
}]
ie. traces of an internal-use-only platform used by the plugin repo to align versions. But I thought of it as being irrelevant.Chris Lee
07/28/2023, 12:35 AMKelvin Chung
07/28/2023, 12:40 AMChris Lee
07/28/2023, 12:41 AMKelvin Chung
07/28/2023, 12:42 AMKelvin Chung
07/28/2023, 2:44 AM