Djuro
12/14/2023, 10:52 AMconventionPlugins
directory, inside settings.gradle.kts
, then myplugin.src
directory, inside of that build.gradle.kts
and needed configuration. Inside the src.main.kotlin.MyPlugin.kt
file I defined my plugin.
In the settings.gradle.kts
of the project I have includeBuild("conventionPlugins")
and I use my plugin without issues in the project, everything works just fine.
I tried all the gradle tasks and everything was running fine when I used Android Studio's UI tool for runing gradle.
BUT, when I attempt to run any task from the terminal, I am getting the following error
> Task :conventionPlugins:myplugin:compileKotlin FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':conventionPlugins:myplugin:compileKotlin'.
> Error while evaluating property 'compilerOptions.jvmTarget' of task ':conventionPlugins:myplugin:compileKotlin'.
> Failed to calculate the value of property 'jvmTarget'.
> Unknown Kotlin JVM target: 21
This never used to happen before, I was able to run all the tasks from the terminal. Note that this is not an Android module, just a separate project whose build I am including if I understood what I was doing correctly 😄
Of course rolling back to before I had the convention plugin, I can still run the commands from the terminal.
When running from terminal I am using ./gradlew clean
for example, meaning the wrapper so why doesn't it take project's java version and takes the one from the system (which is 21 and is not in the compatibility matrix)
Note: I am attaching a photo of what I mean when I say running it from Android Studio's UIAdam S
12/14/2023, 12:05 PMAdam S
12/14/2023, 12:06 PMgradle clean
inside of IntelliJ/Android Studio should use the Gradle wrapperAdam S
12/14/2023, 12:07 PMCLOVIS
12/14/2023, 1:42 PMDjuro
12/14/2023, 1:51 PMDjuro
12/14/2023, 1:51 PMDjuro
12/14/2023, 1:52 PM