Gradle has a set of standard tasks provided by common plugins, but also allows defining custom tasks. A gradle task is an atomic unit of work that is scheduled before or other after tasks depending on task ordering constraints.
Questions tagged [gradle-task]
154 questions
0
votes
1 answer
Is there a way to add a custom up to date condition while preserving the original one?
Say that I am using a Gradle plugin that defines task foo, which is up to date under a certain condition. Unfortunately, I don't have the source, so I don't know when it is.
I would like to make it so that foo is up to date if the original…

Thunderforge
- 19,637
- 18
- 83
- 130
0
votes
0 answers
How to add parameter thread count using existing xml testng suite?
I want to set parameter thread-count in existing suite xml file gradle custom task with type Test. I Want to set useTestNG and after that use TestNG.class for test
String sourceDir = "src"
String resourcesPath =…

ZakZand
- 3
- 6
0
votes
2 answers
Create a cheap new task class in Gradle
According to Groovy doc, Example 40.2, a new class for a task should be created so (simply copy that to the build.gradle):
task hello(type: GreetingTask)
class GreetingTask extends DefaultTask {
@TaskAction
def greet() {
println…

Gangnus
- 24,044
- 16
- 90
- 149
0
votes
1 answer
IntelliJ runs Gradle tasks before commit. How to stop that?
I have added a small example task to the gradle.build in one of the folders of the project:
task fail {
println "ready to fail..."
throw(new Exception("This should not be reached!"))
}
When I am trying to commit this very gradle.build file,…

Gangnus
- 24,044
- 16
- 90
- 149
0
votes
2 answers
How to make a visible for IntellJ Gradle task
If I simply add a task definition to build.gradle
task Xml2Java {
def a;
a++;
}
, I don't see it in the Gradle Project window.
I can add the configuration:
configure(Xml2Java) {
group = 'Publishing'
description = 'Create source code…

Gangnus
- 24,044
- 16
- 90
- 149
0
votes
2 answers
How to filter and execute specific Gradle tasks?
My Android project has different product flavors configured:
productFlavors {
devtracking {
dimension trackingFlavorDimension
}
livetracking {
dimension trackingFlavorDimension
}
stagingwebservice {
…

JJD
- 50,076
- 60
- 203
- 339
0
votes
1 answer
Gradle Include Pattern
Our project recently started separating our unit and integration tests, which used to all be contained within the same package. We created a task to kick off our integration tests:
task intTest(type: test){
systemProperty ...,…

Dan
- 979
- 1
- 8
- 29
0
votes
1 answer
Gradle alias to property name
How can I create an "alias" for gradle property name?
For example, Android Instrumentation Runner provides an ability to execute only certain test class / method:
./gradlew connectedAndroidTest \
…

Andrii Abramov
- 10,019
- 9
- 74
- 96
0
votes
0 answers
gradle clean in linux does not delete the contents of buildDir
Gradle 2.13
Revision: 3b427b1481e46232107303c90be7b05079b05b1c
OS: Linux 3.10.0-327.36.3.el7.x86_64 amd64
In linux on calling the clean task the contents of buildDir path are not deleted whereas the same in windows deletes the contents…

jugal
- 279
- 3
- 7
- 19
0
votes
1 answer
Execute a Task of a sub-module of a Gradle multiproject
I have the following multiproject structure:
settings.gradle
rootProject.name = 'toolbox-backend'
include 'toolbox-components-rest'
include 'toolbox-components-executor'
include 'toolbox-components-toolsyncer'
I'd love to create a task in my root…

xetra11
- 7,671
- 14
- 84
- 159
0
votes
1 answer
Android Studio: Task '-' not found in root project '[Project Name]' after speeding up build
I have been trying to speed up the gradle build time in Android Studio, and now whenever I Build or Sync my project I get the error:
Error:FAILURE: Build failed with an exception.
* What went wrong:
Task '-' not found in root project '[Project…

Ajay
- 437
- 7
- 22
0
votes
1 answer
Gradle version 2.10 is required. Current version is 2.5 Error?
I'm writing an application and trying to execute task using Terminal command gradle task1 created in app/build.gradle file. But it giving following error.
Gradle version 2.10 is required. Current version is 2.5. If using the
gradle wrapper, try…

CoDe
- 11,056
- 14
- 90
- 197
0
votes
1 answer
Android Studio - Execution failed for task compileReleaseJavaWithJavac
I opened an old project separated into 6 modules with Android Studio but it always fails in the building task.
My ENV is :
Ubuntu 14.04
OpenJDK7
Android Studio 2.2 preview 2
It was failing in the build for most of the modules and telling me that it…

Morad Edwar
- 1,030
- 2
- 11
- 27
0
votes
1 answer
android gradle Copy task is not getting executed?
this is my build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
buildscript {
}
repositories {
android {
signingConfigs {
release_config {
}
}
compileSdkVersion…

Lokesh Tiwari
- 10,496
- 3
- 36
- 45
0
votes
1 answer
How to exclude a gradle task or method during build
I defined a task that reads the property file and updates a certain field. I want this to run only when I execute 'release' and not during 'build'.
I am using this gradle-release plugin for release :…

gaganbm
- 2,663
- 3
- 24
- 36