Big Chungus
05/13/2021, 12:40 PMgradlew
for the child module from child module's directory?
/root/
parent/
gradlew
build.gradle
serrings.gradle
child/
build.gradle
another-child/
build.gradle
I've tried this, but it errors while trying to evaluate child as parent
#pwd: /root/child
../parent/gradlew help
Here's the error
FAILURE: Build failed with an exception.
* Where:
Build file '/root/child/build.gradle' line: 6
* What went wrong:
A problem occurred evaluating root project 'child'.
> Project with path ':another-child' could not be found in root project 'child'.
* 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 0s
I'm on Gradle 5.4.1Giorgio Antonioli
05/13/2021, 2:05 PMkotlinOptions.jvmTarget = "1.8"
but I can still access the JDK 11 classes. To make a clear example: the API AccessibleObject.isAccessible
is deprecated since 9. I’d like to still use the source of 1.8 in which that API is not deprecated.Marko Novakovic
05/13/2021, 4:39 PMobject
and implement it in build.gradle.kts
like this:
object Modules {
val DependencyHandlerScope.initializer: ProjectDependency
get() = project(":initializer")
}
and implementation
dependencies {
implementation(Modules.initializer)
}
but it’s not working, it tries to import Modiles.initializer
. is it possible to do it like am trying to?oshai
05/14/2021, 7:58 AMBig Chungus
05/14/2021, 10:48 AM/usr/local/bin
(or any other directory on $PATH
) to ease some pains when working on multi-module projects. It basically finds the nearest gradlew
file to execute with, allowing you to run tasks via gradlew
from any submodule. Helps a ton to make sure the team is building with the same exact gradle setup 😄El Zhang
05/14/2021, 1:09 PMval appClassicExt = project.extensions.findByType(AppExtension::class.java)!!
appClassicExt.applicationVariants.all { variant -> ... }
2. The issues is the all
function:
• When I wrote it normally, it works perfectly, it calls the right all
function which is org.gradle.api.DomainObjectCollection # void all(Action<? super T> action);
• However when I worked with Kotlin std, it calls this one from Kotlin `_Collections.kt`:
public inline fun <T> Iterable<T>.all(predicate: (T) -> Boolean): Boolean {
if (this is Collection && isEmpty()) return true
for (element in this) if (!predicate(element)) return false
return true
}
So the traversal is not working anymore, may I know how to specifically make it call the one I want (The Gradle API)? Thanks.Shabinder Singh
05/14/2021, 1:12 PMorg.gradle.api.tasks.TaskExecutionException: Execution failed for task ':signReleasePublication'.
Caused by: java.io.IOException: secret key ring doesn't start with secret key tag: tag 0x17
Any help would be appreciatednuhkoca
05/18/2021, 9:21 AMiamthevoid
05/19/2021, 2:04 PMShabinder Singh
05/20/2021, 1:21 PMbuildToolsVersion = "30.0.3"
implementation("com.android.tools.build:gradle:4.1.1")
eygraber
05/20/2021, 10:52 PMtasks.withType(KotlinJvmCompile::class).configureEach {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
kotlinOptions {
jvmTarget = "11"
}
}
and
android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
}
when using the kotlin-android
plugin?Justin Tullgren
05/21/2021, 4:41 PMBig Chungus
05/21/2021, 6:10 PMmagnumrocha
05/21/2021, 6:42 PMCaused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.5.0.
Searched in the following locations:
- <https://kotlin.bintray.com/kotlinx/org/jetbrains/kotlin/kotlin-scripting-compiler-embeddable/1.5.0/kotlin-scripting-compiler-embeddable-1.5.0.pom>
- <https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-scripting-compiler-embeddable/1.5.0/kotlin-scripting-compiler-embeddable-1.5.0.pom>
I’m trying to update my project to kotlin 1.5.0, and Coroutines module as well…..ursus
05/22/2021, 3:13 PMSlackbot
05/22/2021, 4:13 PMGopal S Akshintala
05/22/2021, 5:38 PMid("io.freefair.lombok") version "6.0.0-m2"
plugin for lombok on gradle. I have a mix of Java and Kotlin. My plan is to delombok java code and use that while compiling kotlin code. I tried below, but Kotlin doesn’t pick-up delomboked classes. What am I missing?
ourceSets.main {
java.srcDirs("${project.buildDir}/generated/sources/delombok/java/main")
}
tasks {
delombok {
quiet.set(true)
}
compileKotlin {
dependsOn(delombok)
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
}
}
El Zhang
05/23/2021, 3:16 AM*.gradle.kts
are flexible to add/remove easily if developer wants. So I designed a arch like below diagram.
2. As we all know *.gradle.kts
files can not place in the same place as build.gradle.kts
and let build.gradle.kts
apply it if we need to apply some plugins in this *.gradle.kts
(while Groovy DSL works in this case), the common practice is move them to /buildSrc
or a composite-build module, let say /build-env
.
a. If /buildSrc
, seems it does not support include()
includeBuild()
to include plugin source modules
b. if /build-env
, I can refer plugin source via either include()
or includeBuild()
, however it does not have kotlin-dsl-accessors generated, so I can not use plugins{ id("slack")}
with slackNotifyExt{ channel = "" }
dsl extensions (but looks like apply<Plugin>() and configure<Ext>() works)
I'm wondering what is the best practice for this scenario? Below is a simple diagram to show my proposal arch.Gopal S Akshintala
05/23/2021, 4:18 AMsrc/main/java
and Kotlin compiler with ${project.buildDir}/generated/sources/delombok/java/main
?
Problem details and Use-case: I call Kotlin from Java and some Kotlin files use Java classes that are annotated with Lombok. So the idea is (which I followed in Maven as well) is to delombok first to generate sources -> then point Kotlin to use delombok generated sourceSets to prepare end results.
The problem is, when I do this, it appends this sourceSets to src/main/java
(which leads to compile failure)
compileKotlin {
dependsOn(delombok)
sourceSets.main {
java.srcDirs(“${project.buildDir}/generated/sources/delombok/java/main”)
}
}
When I use setSrcDirs
instead of srcDirs
like below, lombok is not able to pick-up java files from src/main/java
(this is strange as I only have set it up in compileKotlin
and not top-level sourceSets)
compileKotlin {
dependsOn(delombok)
sourceSets.main {
java.setSrcDirs(listOf(“${project.buildDir}/generated/sources/delombok/java/main”))
}
}
Big Chungus
05/23/2021, 2:37 PMjanvladimirmostert
05/23/2021, 6:01 PMEntry antlr/SQLLexer.g4 is a duplicate but no duplicate handling strategy has been set. Please refer to <https://docs.gradle.org/7.0.2/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy> for details.
and it's failing on a different non-JVM file every time, sometimes a PNG, sometimes a ANTLR g4 file
The link says I need to set the DuplicatesStrategy
in the CopyPlugin, any idea what that means?xxfast
05/23/2021, 11:58 PMbuildSrc
declarations within your app module?Gopal S Akshintala
05/24/2021, 6:33 AMkotlin.sourceSets.main {
kotlin.setSrcDirs(listOf(buildDir.resolve("generated/sources/delombok/java/main")))
}
idea {
module {
generatedSourceDirs.add(buildDir.resolve("generated/sources/delombok/java/main"))
iml {
whenMerged {
excludeDirs.add(buildDir.resolve("generated/sources/delombok/java/main"))
}
}
}
}
iamthevoid
05/24/2021, 7:04 AMbuildSrc
build.gradle.kts? Import directive and usage looks good (compiler do not warn) but when i try to build project i get many errors looks like build.gradle.kts of buildSrc failed to buildnuhkoca
05/24/2021, 3:06 PMclasspaths
) from root build.gradle.kts
into buildSrc/build.gradle.kts
but I am now getting weird warnings for some declarations as seen in the attachment. How can I get rid of this?Dariusz Kuc
05/25/2021, 9:32 PMClassNotFoundException
during the build
Caused by: java.lang.ClassNotFoundException: kotlinx.coroutines.CoroutinesInternalError
Which generally implies some classpath issue. I'm using Gradle 6.8 with Kotlin 1.4.32 and coroutines 1.4.3. Wondering if anyone else encountered similar issue?
While looking at the dependency tree (https://scans.gradle.com/s/uvf7bsxzvgwso/dependencies?dependencies=kotlinx-coroutines-core&expandAll) the only config on kotlinx-coroutines-core
is from the kotlinCompilerPluginClasspath
. When I run gradle -q dependencies --configuration kotlinCompilerPluginClasspath
you can see that it comes from kotlin-scripting-compiler-embeddable
kotlinCompilerPluginClasspath
\--- org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.4.32
+--- org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.4.32
| +--- org.jetbrains.kotlin:kotlin-scripting-common:1.4.32
| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.32
| | | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.32
| | | \--- org.jetbrains:annotations:13.0
| | \--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8
| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.71 -> 1.4.32 (*)
| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.71 -> 1.4.32
| +--- org.jetbrains.kotlin:kotlin-scripting-jvm:1.4.32
| | +--- org.jetbrains.kotlin:kotlin-script-runtime:1.4.32
| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.32 (*)
| | \--- org.jetbrains.kotlin:kotlin-scripting-common:1.4.32 (*)
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.32 (*)
| \--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8 (*)
\--- org.jetbrains.kotlin:kotlin-stdlib:1.4.32 (*)
(*) - dependencies omitted (listed previously)
and sure enough the published artifact references old version of coroutines -> https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-scripting-compiler-impl-e[…]e/1.4.32/kotlin-scripting-compiler-impl-embeddable-1.4.32.pom (release 1.5.10 still points to 1.3.8 coroutines as well). Any ideas why runtime dep would be blowing stuff up?ubu
05/26/2021, 10:44 AM.aar
library, which is located on the project level: libs/lib.aar
. I declare it in an Android Library module in the following manner:
implementation files('libs/lib.aar')
After updating to the latest Android Gradle Plugin:
-classpath 'com.android.tools.build:gradle:3.5.3'
+classpath 'com.android.tools.build:gradle:7.0.0-beta02'
I got this error message:
Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error)
The only thing I could find on Stackoverflow was the following:
https://stackoverflow.com/questions/60878599/error-building-android-library-direct-local-aar-file-dependencies-are-not-supp
But these solutions seem outdated.
Following official documentation here didn’t help either.
Did someone encounter this issue? Need help! 🆘rnett
05/27/2021, 5:42 AMwithJava()
? configurations["jvmRuntimeClasspath"]
results in ClassNotFound
errorsSourabh Rawat
05/27/2021, 9:03 AMTYPESAFE_PROJECT_ACCESSORS
?nikolaymetchev
05/27/2021, 9:36 AMnikolaymetchev
05/27/2021, 9:36 AMChris Miller
05/28/2021, 3:10 PMnikolaymetchev
05/28/2021, 4:05 PMtask.plugins {
kotlin {
outputSubDir = 'kotlin'
}
}
And add protobuf-kotlin
to your classpath and you are good to go!