therealbluepandabear
03/20/2021, 10:51 PMtyrondis
03/21/2021, 5:08 PMtasks.register()
runs as part of the check
lifecycle in Gradle's Kotlin DSL?therealbluepandabear
03/22/2021, 4:12 AMribesg
03/22/2021, 12:17 PMribesg:myProject/ (develop) $ ./gradlew
> Task :buildSrc:compileKotlin FAILED
e: No class roots are found in the JDK path: /Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':buildSrc:compileKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at <https://help.gradle.org>
BUILD FAILED in 1s
ribesg:myProject/ (develop) $ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
16 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 16" /Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home
11.0.10 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 11" /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
1.8.0_282 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 8" /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home
ribesg:myProject/ (develop) $ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
Something seem to be looking for the JDK 15 which no longer exists now that it has been updated to 16. I verified using logs I added to my gradlew
scripts that it’s calling my JDK 11's java. What references the JDK 15 here? Does the kotlin compiler/plugin itself has some kind of cache ? I removed .gradle
and build
folders multiple times and stopped Gradle daemonsJishin Dev [JD]
03/22/2021, 1:56 PM~/<username>/.gradle/gradle.properties
file from kotlin code (not kts
) in an android project?Marc Knaup
03/22/2021, 4:25 PMbuildSrc
? So that it can be used across all build scripts.
https://github.com/fluidsonic/raptor/blob/master/buildSrc/sources/Versions.ktmiqbaldc
03/26/2021, 11:00 AMbuild.gradle.kts
inside buildSrc
to be used as a common/base dependencies, such as:
// myapp2/build.gradle
apply plugin: 'commons.android-dynamic-feature'
// myapp3/build.gradle
apply plugin: 'commons.android-dynamic-feature'
_*Problems*_:
// image on the left
com.android.build.gradle.internal.dsl.BaseAppModuleExtension
// image on the middle
com.android.build.gradle.AppExtension
I’ve 3 gradle files
1. |-app/build.gradle.kts
2. |-buildSrc/build.gradle.kts // this is to configure below
3. |-buildSrc/commons/build.gradle.kts
In the no. 3, is using AppExtension
instead of BaseAppModuleExtension
,
with AppExtension
, I’m unable to define android.buildFeatures.*
(see image on the right)
lmk if you guys needs more information to know about this 🙏Carter
03/29/2021, 7:56 PMkotlin {
jvm {
// Comment to bypass failure with Gradle 7.0
// withJava()
}
...
}
Is there a workaround or an issue on YouTrack I can follow?
This is the exception I see:
java.lang.NoSuchMethodError: 'java.lang.String org.gradle.api.tasks.SourceSet.getCompileConfigurationName()'
at org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget.setupDependenciesCrossInclusionForJava(KotlinJvmTarget.kt:155)
at org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget.access$setupDependenciesCrossInclusionForJava(KotlinJvmTarget.kt:27)
at org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget$withJava$3.execute(KotlinJvmTarget.kt:78)
at org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget$withJava$3.execute(KotlinJvmTarget.kt:62)
at org.gradle.configuration.internal.DefaultUserCodeApplicationContext$CurrentApplication$1.execute(DefaultUserCodeApplicationContext.java:100)
at org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction$1.run(DefaultCollectionCallbackActionDecorator.java:95)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
at org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction.execute(DefaultCollectionCallbackActionDecorator.java:92)
at org.gradle.api.internal.DefaultDomainObjectCollection.all(DefaultDomainObjectCollection.java:163)
at org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget.withJava(KotlinJvmTarget.kt:62)
PHondogo
03/31/2021, 10:51 AMpabl0rg
03/31/2021, 7:21 PMtherealbluepandabear
04/04/2021, 5:04 AMIvan Đorđević
04/05/2021, 1:39 PMkotlin-gradle-plugin
to buildSrc
?
My idea is to write reusable extensions of various gradle types to provide usages for multiple KMM modules. But no matter what I've tried it won't work.
1. implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31")
fails with Unable to load class 'com.android.build.gradle.BaseExtension'.
2. ``compileOnly("org.jetbrains.kotlinkotlin gradle plugin1.4.31")` fails latter down the line Caused by: java.lang.ClassNotFoundException: org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
Here's the full build.gradle.kts
for `buildSrc`:
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
plugins {
`kotlin-dsl`
}
dependencies {
compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31")
}
kotlinDslPluginOptions {
experimentalWarning.set(false)
}
Slackbot
04/07/2021, 5:13 AMYasutaka Kawamoto
04/07/2021, 9:20 AMturansky
04/07/2021, 8:59 PMbuildSrc
(Kotlin 1.4.32
, Gradle 6.8.3
)?Paul Woitaschek
04/08/2021, 9:58 AMtasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
dependsOn(generateKotlinCodeTask)
}
However this one now fails on multiplatform.
I debugged the task names and I can make it work if I add that task dependency for KotlinNativeCompile
as well.
However I'm asking myself if this is the correct approach to hook code generation into the build process.Marc Knaup
04/08/2021, 12:11 PMsettings.gradle.kts
the value of System.getProperty("user.dir")
is now /
instead of the project’s path.
Gradle command line works fine though 🤔Joel
04/12/2021, 11:30 PMchristophsturm
04/13/2021, 9:29 AMZach Klippenstein (he/him) [MOD]
04/13/2021, 4:48 PMRequiresOptIn
annotation, and another module that depends on that module and annotates some code with the custom annotation, the Kotlin compiler won’t actually enforce the opt-in if the dependency on the module containing the annotation is specified as implementation
or compileOnly
– it must be an api
dependency.
Even weirder, the IDE (Android Studio Arctic Fox) actually will still enforce the annotation with those other configurations – only command-line gradle builds don’t.
I haven’t seen any documentation about this requirement, and it doesn’t really make sense to me. Is this a gradle bug? A Kotlin bug? Kotlin gradle plugin bug? Or just expected behavior?Marc Knaup
04/14/2021, 4:18 PM-Xir-per-module
with Gradle in Kotlin 1.5?
With the previous approach I get this error:
FileNotFoundException: /Users/marc/Documents/project/modules/web/build/classes/kotlin/main (Is a directory)
Karlo Lozovina
04/15/2021, 3:15 PMgradle run
console output of the app and of Gradle itself are interleaved - is there a way to stop Gradle printing how much the run task is been running for?turansky
04/15/2021, 8:49 PMjvmargs
, which declared in gradle.properties
:
org.gradle.jvmargs=-Xmx2g
to have less memory on CI only?Chilli
04/16/2021, 8:03 AMimplementation
and compileOnly
? The only difference I found on Google is that implementation
is available at runtime, but what does it mean exactly? Without a special plugin, Gradle doesn't shade dependencies anyway, no?Shabinder Singh
04/17/2021, 11:21 PMrobstoll
04/18/2021, 10:34 AMBenjamin AIMONE
04/19/2021, 8:16 AM`java-library` to replace ``java-gradle-plugin`
with toolchain in my project, it can build with or without, any suggestion ? https://github.com/klaxit/hidden-secrets-gradle-pluginmelatonina
04/19/2021, 9:44 AMjar {
// ... Manifest stuff
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
This works with my test project but has no effect in my actual project. What could be the cause?gabrielfv
04/19/2021, 9:20 PMa -- b
\- c
b -- c
c -- d
I´m trying to find a way to find which modules depend on d
, in this case c
. If I wanted to know about c
, a
and b
. Ultimately, being able to do this recursively would be convenient. Since, transitively, every module would depend on d
.jean
04/20/2021, 8:13 AMgradle.build
while using dependencyResolutionManagement
in settings.gradle
?
What I have so far:
// build.gradle.kts
repositories {
maven {
url = uri("<https://maven.pkg.jetbrains.space/myTeam/p/myProject/maven>")
credentials {
username = project.extra["space_usr"].toString()
password = project.extra["space_pwd"].toString()
}
}
}
// settings.gradle.kts
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
But I get the following error : Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'app/build.gradle.kts'
If I remvove repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
then I get the following error :
Could not determine the dependencies of task ':app:kaptDebugKotlin'.
> Could not resolve all dependencies for configuration ':app:kotlinKaptWorkerDependencies'.
The project declares repositories, effectively ignoring the repositories you have declared in the settings.
You can figure out how project repositories are declared by configuring your build to fail on project repositories.
See <https://docs.gradle.org/7.0-rc-1/userguide/declaring_repositories.html#sub:fail_build_on_project_repositories> for details.
> Could not find org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.4.32.
Searched in the following locations:
- <https://maven.pkg.jetbrains.space/>...
- <https://maven.pkg.jetbrains.space/>...
Required by:
project :app
I could add my custom maven dependency in settings.gradle.kts
but project.extra
is not accessible and requires clear text