Questions tagged [gradle-task]

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.

154 questions
2
votes
0 answers

How do I implement "application run" task in Gradle?

I'm using Gradle and I wonder how I can implement a run task so I can run the program from the command "./gradlew run". I have a project named "demo" and it have the task "application run". Then I created the project "HouseObserver" and it have not…
euraad
  • 2,467
  • 5
  • 30
  • 51
2
votes
1 answer

Reference spring-boot assembled jar in gradle ssh plugin

I would like to create a custom task in gradle, that will upload assembled jar to a remote server. My best working result is doLast { ssh.run { def jarFile = "${jar.baseName}-${version}.jar" session(remotes.role('qa')) { …
2
votes
2 answers

How to start spring boot application with a gradle task on a forked process?

I have a spring boot application with a dummy endpoint on which I wanna execute a gatling load test. gradle task: task testLoad(type: JavaExec) { description = 'Test load the Spring Boot web service with Gatling' group = 'Load Test' …
aurelius
  • 3,946
  • 7
  • 40
  • 73
2
votes
1 answer

Gradle: where are task dependencies defined for distZip task

I am using the gradle application plugin. I noticed that: distZip task get's run before the assemble task. And I can see from the docs (link above), and confirmed during my gradle run, that the distZip tasks depends on: jar, startScripts…
Ben
  • 6,567
  • 10
  • 42
  • 64
2
votes
2 answers

Gradle HTTP Plugin

I need to upload file with HTTP post in gradle build. I found HTTPPlugin which could make the deal. I made a simple build but it gives me error: Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'HttpTask' for root…
Jarno Lahtinen
  • 1,713
  • 17
  • 30
2
votes
1 answer

Task and plugin conflict in Gradle (Failed to apply plugin [class 'org.gradle.langu...)

I tried to run a task from build.gradle using the following command: gradle footype However the build failed and displayed these two error messages that I want to fix: > Configure project : The Task.leftShift(Closure) method has been deprecated…
Abdelghani Bekka
  • 576
  • 9
  • 18
2
votes
1 answer

How execute a task inside doLast in Gradle?

I am trying to create a zip using gradle task but while running inside doLast{} , it's throwing error saying : > Cannot call Task.dependsOn(Object...) on task ':app:testZip' after task has started execution. MyCode : doLast { …
Test App
  • 33
  • 5
2
votes
2 answers

How to run gradle tasks from specific ".gradle" file with terminal in android studio?

I am new to writing gradle tasks. I have added a .gradle file into root of my project in this gradle file there are some tasks, my question is how to run these tasks via Terminal in android studio? When i run a task with Terminal in android studio…
Edalat Feizi
  • 1,371
  • 20
  • 32
2
votes
0 answers

Why do we need doFirst block in the gradle tasks?

From my testing, both task taskA { doFirst { println("$name first") } doLast { println("$name second") } } and task taskB { doLast { println("$name first") println("$name second") …
Aye Maung
  • 51
  • 5
2
votes
1 answer

Trying to get the group name and version of my build.gradle dependencies in a custom gradle task

I'm trying to do something which I feel should be relatively straightforward but nothing on the internet seems to be giving me what I'm after. Basically, I want to take the compile/testCompile dependencies from my build.gradle (I don't want any of…
MDalt
  • 1,681
  • 2
  • 24
  • 46
2
votes
1 answer

Gradle equivalent to 'grails -Dgrails.env=production run-app'

I'm upgrading my Grails 2.5.1 web-app to Grails 3.1.1. To run the app locally with production as active environment I used grails -Dgrails.env=production run-app Now I'm using Gradle tasks, in particular gradle bootRun. What's the easiest…
ilPittiz
  • 734
  • 1
  • 10
  • 23
2
votes
1 answer

Dependencies for custom incremental Gradle compile task

I'm wondering about the best approach for managing a custom compile step with files that have transitive dependencies if want my compile task to be incremental. Here's the specific use case: I have a directory full of templates (handlebars templates…
Oliver Dain
  • 9,617
  • 3
  • 35
  • 48
1
vote
1 answer

Why is my custom Gradle task running even when the input is unchanged

I've created a custom Gradle task in Java (just put within buildSrc, so a local custom task) public class ImageMergerTask extends DefaultTask{ public File directory; @TaskAction public void greet() { System.out.println("hello…
Richard Tingle
  • 16,906
  • 5
  • 52
  • 77
1
vote
2 answers

Gradle copy task runs on clean

I have a gradle Copy task that copies assets from the project directory into the build directory: tasks.register("copyAssets", Copy) { def fromDir = "${project.projectDir.toString()}/../assets" def toDir =…
digory doo
  • 1,978
  • 2
  • 23
  • 37
1
vote
1 answer

A gradle project compiles successfully, how to replicate this success if it is included in another project?

The project I intend to include is the latest version of splain: https://github.com/tek/splain Which is built with gradle, and has the following extra task definition (in gradle kts): // invoke task("dependencyTree") { …
tribbloid
  • 4,026
  • 14
  • 64
  • 103
1 2
3
10 11