165 questions
1
vote
0
answers
79
views
+200
In a gradle project that contains both Kotlin and Scala code, what's the easiest way to make Kotlin compilation to depend on Scala bytecode?
In gradle, both Kotlin and Scala compiler plugins have limitations: they can both compile Java code in mixed-order, but they cannot compile each other. The only option is to:
compile Scala code first
...
0
votes
1
answer
41
views
Gradle task how to handle npm exit codes
I am trying to add a pre-commit check as a gradle task that handles backend and frontend in one place:
tasks.register('preCommit', Exec) {
dependsOn 'spotlessCheck'
workingDir new File(...
0
votes
0
answers
31
views
Grails project - import class into build.gradle
I'm trying to define a custom Gradle task in a Grails project.
Here's the task implementation
MyCustomTask.groovy
package my.project
import my.project.stuff.DoSomething
import org.gradle.api....
1
vote
1
answer
47
views
Configure Gradle to work like a script or batch file
I have a Kotlin program that looks like this:
fun main(args: Array<String>) = runBlocking {
if(args.first() == "deploy") {
// do deployment
}
}
Putting aside the ...
0
votes
0
answers
1k
views
build-logic with convention plugin and global Gradle task problem
I migrated my project from buildSrc to build-logic with conversion plugins. All plugins work good but I also have a Gradle task that downloads localizations from 3rd party service and stores its to ...
0
votes
1
answer
64
views
Running android emulator from vs code gradle error
I am new to flutter and coding in general. I am trying to run an android emulator from vs code but I keep getting the below error when trying to do so. Could you point me in the right direction of how ...
2
votes
1
answer
504
views
Gradle continuous build behaves odd
Gradle is a magic box for me. I often don't get it and always do try and error.
I use gradle 8.1 and groovy scripts. I have this small task
import java.time.Instant
tasks.register('continuous-build') ...
2
votes
2
answers
3k
views
Cannot set environment variable or property in Gradle outside test
I have been trying to set a simple environment variable (or system property, whatever works really) through build.gradle file to access it from a java method (which is not part of integration tests) ...
0
votes
1
answer
89
views
Continue where an interrupted task left off
I have an application for which the testing is quite extensive. Essentially, we must run the application a few hundred thousand time on different input. So I have built a custom Gradle task which ...
0
votes
1
answer
129
views
How to modify error message after executing a command via a Gradle task
I'm implementing a Gradle Java plugin which registers below task.
TaskProvider<Exec> taskProvider = project.getTasks().register("spectralTask", Exec.class);
taskProvider.configure(exec ...
3
votes
1
answer
411
views
Using getProject() with Gradle Configuration Cache
Gradle documentation states that using the getProject() method in the @TaskAction method of a Task class should not be used if you want compatibility with Gradle Configuration Cache. The question I ...
2
votes
1
answer
1k
views
How do you set up a property in a custom gradle task?
I want to write a task that takes a directory from , does something with the files in it and writes the result into some other directory to.
I've been led to believe this was the way to define such a ...
8
votes
4
answers
3k
views
Gradle task to take a build of specific build flavors (more than one)
In my app, I have more than 30 build variants. Every time when I release the app, I need to publish it to different platforms, therefore I build 5 different build variants.
Currently, I am doing this:
...
0
votes
1
answer
2k
views
In gradle, how to make an existing task "build" depending on the publishing tasks of another module?
When I try to declare the task "build" depends on another task like this:
task("build").dependsOn(
gradle.includedBuild("splain").task("publishToMavenLocal")...
1
vote
1
answer
316
views
Run Application configuration stopped working: appears to start executing gradle task [:app:Api.main()] all of a sudden
Yesterday I was able to run a plain Java class in Android Studio without any problems. I did this by creating an Application configuration:
... for running the main() method of some class I defined ...
1
vote
1
answer
699
views
Gradle catch error from file in custom task
I'm new to Gradle and I don't know much about it, but in my gradle file I defined the following task:
task helloWorld {
description "Custom task"
ext.srcFile = file("build/reports/...
0
votes
1
answer
877
views
How to run a JavaExec gradle task with arguments when the task is called in finalizedBy?
I created a JavaExec task that connects to a db and does some checks. In my flyway build.gradle I call the task like this:
flywayMigrate.finalizedBy(rootProject.checkOracleStandards)
The task works ...
1
vote
1
answer
118
views
Fix custom tasks in gradle. Want to run it manually via at Execution Phase
Why this is not working?
I config it first then unzip it at the execution phase where I could run it manually.
val nativesOS : Configuration by configurations.creating {
this.isTransitive = ...
4
votes
0
answers
1k
views
Gradle custom task type defined in buildSrc not accessible in subprojects for multi-project structure
I have a gradle multi-project hierarchy:
root
-buildSrc
-src/main/groovy/com/CustomTask.groovy
-subproj1
-subproj1-build.gradle-settings.gradle I am able to invoke custom task - com.CustomTask only ...
-1
votes
1
answer
1k
views
Gradle Task in Android Studio is unknown property
I am moving an old project which runs in it's original project. But, it's gradle has been giving me issues in a new project. The issue is that my gradle task is not recognized by the preBuild call.
I ...
1
vote
0
answers
111
views
android gradle task of type exec execution failure
I have written the following simple task in my android project.
task testing (type: Exec) {
println workingDir
}
gradlew testing
when I run the above command in the command prompt(Windows), ...
0
votes
1
answer
467
views
Gradle systemProperty in custom task not setting Spring Profile
I'm trying to selectively deactive tests if there is a spring profile called "unit", which is working:
@DisabledIfEnvironmentVariable(named = "SPRING_PROFILES_ACTIVE", matches = &...
0
votes
1
answer
442
views
Can a standalone gradle plugin export a custom task type?
I have a standalone Gradle plugin that includes a custom task type:
gradle-conventions/build.gradle
plugins {
id 'groovy-gradle-plugin'
id 'maven-publish'
}
group = 'com.example'
version = '1.0'
...
5
votes
2
answers
862
views
Gradle lazy Exec-Task configuration
I'm running into a problem when configuring an Exec-Task using an Extension-Property.
Problem
The configuration of my Exec-Task relies on a String-Property that is defined in an extension. ...
1
vote
0
answers
2k
views
Run gradle task only on windows
I have some task:
task foo {
//Do something
}
foo.dependsOn(":bar:baz")
foo.dependsOn(":bar2:baz2")
This task should only run on windows. I know, I could do:
import org.apache....