https://kotlinlang.org logo
#gradle
Title
# gradle
j

Justin Tullgren

09/21/2023, 4:09 PM
Hi, I am using an
includedBuild
to develop a
kotlin compiler plugin
. The subplugin however is ways being “fetched” and not using the artifact from the included build, which is requiring me to publish to mavenlocal or another repo for testing. Is there a way to have the kotlin compiler use the artifact from the build?
including the build in the
pluginManagement
section doesn’t have a substitution option, so it looks like the build class path doesn’t have the artifact and is looking for the gradle coordinate of the
kotlin sub plugin
provided by the gradle plugin.
v

Vampire

09/21/2023, 5:11 PM
You probably need to include at top-level instead or additionally.
j

Justin Tullgren

09/21/2023, 7:06 PM
i tried both
no luck unfortunately
v

Vampire

09/21/2023, 7:08 PM
Can you maybe knit an MCVE?
j

Justin Tullgren

09/21/2023, 7:09 PM
i’ll try. i don’t have a place to host though
v

Vampire

09/21/2023, 7:09 PM
GitHub?
Or package it as zip and attach here
j

Justin Tullgren

09/21/2023, 7:10 PM
k, let me get it together
IncludeBuildIssueExample.zip
v

Vampire

09/21/2023, 8:41 PM
Well, it is as I suspected. Not having instructions how to use the MCVE I did
gw build
and got
Copy code
Execution failed for task ':app:compileKotlin'.
> Could not resolve all files for configuration ':app:kotlinCompilerPluginClasspathMain'.
   > Could not find com.example:plugin-kotlin:0.0.1.
     Searched in the following locations:
       - file:/C:/Users/bkautler/.m2/repository/com/example/plugin-kotlin/0.0.1/plugin-kotlin-0.0.1.pom
       - <https://repo.maven.apache.org/maven2/com/example/plugin-kotlin/0.0.1/plugin-kotlin-0.0.1.pom>
       - <https://dl.google.com/dl/android/maven2/com/example/plugin-kotlin/0.0.1/plugin-kotlin-0.0.1.pom>
     Required by:
         project :app
This means it is needed as a dependency in a normal configuration. So I just added the
includeBuild("buildLogic")
top-level and it went on until the next error which is during app kotlin compilation after
plugin-kotlin
was built already:
Copy code
> Task :buildLogic:plugin-gradle:compileKotlin UP-TO-DATE
> Task :buildLogic:plugin-gradle:compileJava NO-SOURCE
> Task :buildLogic:plugin-gradle:pluginDescriptors UP-TO-DATE
> Task :buildLogic:plugin-gradle:processResources UP-TO-DATE
> Task :buildLogic:plugin-gradle:classes UP-TO-DATE
> Task :buildLogic:plugin-gradle:jar UP-TO-DATE

> Configure project :app
!!! Gradle Plugin Applied

> Task :app:processResources NO-SOURCE
> Task :app:processTestResources NO-SOURCE
> Task :buildLogic:plugin-kotlin:processResources
> Task :buildLogic:plugin-kotlin:compileKotlin
> Task :buildLogic:plugin-kotlin:compileJava NO-SOURCE
> Task :buildLogic:plugin-kotlin:classes
> Task :buildLogic:plugin-kotlin:jar

> Task :app:compileKotlin
e: Working

> Task :app:compileKotlin FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details
j

Justin Tullgren

09/21/2023, 8:53 PM
where did you add includeBuild(“buildLogic”)? settings.gradle.kts or build.gradle.kts?
v

Vampire

09/21/2023, 8:54 PM
Well, one compiles, the other not 😄
j

Justin Tullgren

09/21/2023, 8:54 PM
This
e: Working
is showing it working, i’m throwing an error in the example
v

Vampire

09/21/2023, 8:54 PM
Yeah, thought so
j

Justin Tullgren

09/21/2023, 8:55 PM
ok so just including it worked, then something in my setup is incorrect. i’ll have to mess around again
v

Vampire

09/21/2023, 8:55 PM
👌
j

Justin Tullgren

09/21/2023, 8:55 PM
thanks!
v

Vampire

09/21/2023, 8:55 PM
yw