Dilan
11/19/2023, 12:29 AMTask 'run' not found in root project 'FlippingTileProject'.
I was suggested to do this, but this doesn't work, errors on both application and mainClass.
plugins {
id("java")
id("application")
}
group = "org.fliptile"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
}
tasks.test {
useJUnitPlatform()
}
application {
mainClass.set("org.fliptile.Main")
}
Would appreciate any help.
Edit:✅ Fixed, thank you Adam.
Problem was with Scanner trying to read elements that were never there, also I put this into the build.gradle.kts so input actually worked correctly.
tasks.named<JavaExec>("run") {
standardInput = System.`in`
}
Abe
11/22/2023, 11:13 PMjvmTarget
in a central location:
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.fromTarget("11")) // fails
// jvmTarget.set(JvmTarget.JVM_11) // works
}
}
> > No signature of method: static org.jetbrains.kotlin.gradle.dsl.JvmTarget.fromTarget() is applicable for argument types: (String) values: [11]
> Possible solutions: getTarget()
Why cannot I use the fromTarget
function in my Groovy script?
https://github.com/JetBrains/kotlin/blob/1.8.0/libraries/tools/kotlin-gradle-compi[…]c/generated/kotlin/org/jetbrains/kotlin/gradle/dsl/JvmTarget.ktKelvin Chung
11/30/2023, 9:17 PMProvider
is not meant to be nullable, correct? I'm just wondering why I sometimes get Provider<T?>
type inferences.JoshuA
12/08/2023, 2:28 PMJoshuA
12/08/2023, 2:28 PMKelvin Chung
12/08/2023, 5:02 PMProvider.isNotPresent
or Provider.filterNot
, in line with how there are extensions like these in the Kotlin standard library.Nuh Koca
12/08/2023, 8:50 PMGroovy
to combine jacoco reports from sub modules. However, we are migrating into Kotlin DSL
and tried to 1:1 conversion but it is not working and throwing `Error while creating jacoco report`(Please find the entire stacktrace and both versions in 🧵). Is there something wrong with it?Abdullah Zubair
12/19/2023, 3:56 PMDarryl Miles
01/22/2024, 6:43 PMtask explodedWar(type: Sync) {
into "${buildDir}/libs/exploded/yourWar.war"
with war
}
// my efforts get to
tasks.register<Sync>("explodedWar") {
into("${layout.buildDirectory}/libs/exploded/yourWar.war")
with(war)
// ^^^ --- red error markers
}
// can't find anything with the correct type on content assist
It wants a CopySpec
which I assume needs to be all the standard outputs in the WAR tree format
There is an implicit configuration called archives
that produces the non-exploded WAR file. So this must clearly have configuration with all the data in some format necessary (input file -> output file, mappings)
Without the with()
part, nothing appears to happen, I also don't get the default configuration action for archives
anymore, when really I would like it to always emit the standard output artifacts, but in addition produce an exploded. (edited)Vampire
01/28/2024, 4:48 PMorg.gradle.kotlin.dsl.normalization.CompileAvoidanceException: class .../CachedProviderKt: inline fun cached(): compile avoidance is not supported with public inline functions
want to tell me?
Or better asked, what can I do about it besides not using a library in build logic that provides a public inline function?István Mészáros
02/04/2024, 12:19 PMdependencies {
implementation("group:name:version") // pulls in the main dep
implementation("group:name:version") {
capabilities {
requireCapability("group:name-cap1:version") // pulls in cap1 of main dep
}
}
implementation("group:name:version") {
capabilities {
requireCapability("group:name-cap2:version") // pulls in cap2 of main dep
}
}
}
I could make it a bit more readable:
dependencies {
"group:name:version".let {
implementation(it)
implementation(it) {
capabilities {
requireCapability("$group:$name-cap1:$version")
}
}
implementation(it) {
capabilities {
requireCapability("$group:$name-cap2:$version")
}
}
}
}
However, something like this would be nice:
dependencies {
implementation("group:name:version", withCapabilities = "cap1", "cap2)
}
Does anything like that exist?Mohammed Mahmood Ahmed
02/11/2024, 11:41 AMapplicationVariants.forEach { variant ->
variant.outputs.forEach { output ->
val SEP = "_"
val date = Date()
val dateFormat = SimpleDateFormat("dd_MM_yy_hh_mm")
val formattedDate = dateFormat.format(date)
var gitBranch = getGitBranch()
gitBranch = gitBranch.take(gitBranch.length - 1)
val apkName = variant.name + SEP + output.versionCode + SEP + gitBranch + SEP + formattedDate + ".apk"
// output.outputFileName = apkName
}
}
the last line of code ie output.outputFileName gives error that its a val and cant be reassigned... however there's a blog post https://narendranathchatterjee.medium.com/make-your-build-apks-tell-you-more-f51f2c038831 which does this
Is it due to the fact that I am using kotlin gradle or is it something else... Also how do I resolve this?Omico
02/21/2024, 10:59 AMpublish
or publishToMavenLocal
?
tasks.withType<AbstractPublishToMaven> {
dependsOn(tasks.build)
}
tasks.withType<AbstractPublishToMaven>().configureEach {
dependsOn(tasks.build)
}
tasks.withType<AbstractPublishToMaven>().all {
dependsOn(tasks.build)
}
Caleb Cushing
02/29/2024, 6:20 PMimport org.gradle.accessors.dm.LibrariesForLibs
val asciidoclet by configurations.creating {}
val libs = the<LibrariesForLibs>()
dependencies {
asciidoclet(libs.plugin.asciidoc.javadoc)
}
tasks.withType<Javadoc> {
options {
docletpath(*asciidoclet.files.toTypedArray())
doclet = "org.asciidoctor.Asciidoclet"
jFlags("-baseDir", project.layout.projectDirectory.asFile.name)
}
}
Shalom Ben-Zvi Kazaz
03/20/2024, 7:59 PMAndré Martins
03/22/2024, 6:00 PMgradle bootRun -Dspring.profiles.active=local
the profile is not set, it only works if I set env var like SPRING_PROFILES_ACTIVE=local gradle bootRun
why is that? Does -D<prop>=<value>
not work with Kotlin DSL?JRF IBITF
03/26/2024, 7:39 AMRun 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.* Exception is: org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.android.application', version: '8.3.1', apply: false] was not found in any of the following sources: can u help me?
Shalom Ben-Zvi Kazaz
03/27/2024, 10:25 PMcom.squareup.retrofit2:retrofit:2.9.0
-- com.squareup.okhttp3:okhttp:3.14.9
now I want to add a direct dependency on com.squareup.okhttp3:logging-interceptor, and i want it to be the same version of okhttp that retrofit brings,3.14.9.
of course i can declare com.squareup.okhttp3:logging-interceptor to the same version, but i want to know if there is a way to do it using some resolution strategy?
so if i declare com.squareup.okhttp3logging interceptor4.12.0 i want to force it to the same version of okhttp 3.14.9.André Martins
04/27/2024, 7:57 PM(code in comment)
This is working currently, but I do have two questions/concerns:
• Do I always need to setup everything inside project.afterEvaluate
?
• Is there a more convenient type instead of Property for specifying a function? In order to avoid .get()()
Thanks in advance ✌️arhan subaşı
04/30/2024, 7:34 PMjava.io.IOException: Unable to delete directory 'C:\Users\subas\flutter_projects\StablePayMobile\near_pay_app\build\app\outputs\apk\debug'Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory. - C:\Users\subas\flutter_projects\StablePayMobile\near_pay_app\build\app\outputs\apk\debug\app-debug.apk * 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 BU�LD FAILED in 4s Running Gradle task 'assembleDebug'... 5,0s Error: Gradle task assembleDebug failed with exit code 1 ""how can I fix this""
A Abhishek
05/02/2024, 9:46 AMconfig.gradle
ext.applyBuildConfigs = { baseExtension -> .... }
baseExtension is the android extension.
I am using it in build.gradle.kts like :
android {
val applyBuildConfigs: Closure<Any?> by extra
applyBuildConfigs(android)
}
This works as expected
I wanted to convert config.gradle to kts , i tried this approach :
config.gradle.kts
val applyConfigs: (com.android.build.gradle.internal.dsl.BaseAppModuleExtension) -> Unit by extra({ baseExtension ->
....
})
but I get the error :
Unresolved reference: android
I can get rid of this error by adding Android Gradle Plugin to the classpath of config.gradle.kts
config.gradle.kts
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath (libs.agp)
}
}
val applyConfigs: (com.android.build.gradle.internal.dsl.BaseAppModuleExtension) -> Unit by extra({ baseExtension ->
})
I am not sure if this is the correct way but it makes the error go away (IDE still shows error but IDE shown error for all non build.gradle.kts files)
But now when I call applyConfigs(android)
I get the error
class com.android.build.gradle.internal.dsl.BaseAppModuleExtension_Decorated cannot be cast to class com.android.build.gradle.internal.dsl.BaseAppModuleExtension
What would be the correct way to achieve this ? I do not want to create custom plugins for this right now .André Martins
05/08/2024, 4:42 PMLibrariesForLibs
is gone and no such package as org.gradle.accessors
, I saw that versionCatalogs.named("libs")
work but lack type safety. Any ideias on how we can access libs now in pre-compiled scripts?Thaddeus Fisher
05/15/2024, 12:55 AMkotlin-dsl
plugin in buildSrc fetches the plugin and a bunch of Kotlin compiler dependencies from the plugin portal, and doesn't use the JARs that ship with the Gradle distribution?Chak Chi Sio
05/23/2024, 8:02 PMusingComposeCompiler
don't have a configured value....
fun Project.configure() {
if (tasks.findByName(TASK_NAME) != null) {
val taskA = tasks.named(TASK_NAME, CheckComposeAllowListTask::class.java)
val taskB = tasks.withType(KotlinCompile::class.java)
val booleanOutput: Property<Boolean> = objects.property(Boolean::class.java)
taskA.configure {
usingComposeCompiler.set(booleanOutput)
}
taskB.configureEach {
doFirst {
val usingComposeCompiler = kotlinOptions.freeCompilerArgs.any { arg ->
arg.contains("androidx.compose.compiler")
}
booleanOutput.set(usingComposeCompiler)
}
finalizedBy(taskA)
}
}
}
what i am trying to do is that, i configure TaskA with a property that will later be set from TaskB.doFirst.....i am actually not sure if this is the right way to approach it.gold man
06/23/2024, 8:52 PMgold man
06/23/2024, 8:53 PMgold man
06/23/2024, 8:53 PMRun 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.
gold man
06/23/2024, 8:54 PMgold man
06/23/2024, 8:54 PMFredrick Eisele
07/15/2024, 8:37 PM