Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add task dependency to existing Gradle task

I'm going to lose my mind about this. I have a build.gradle file that looks something like:

apply plugin: 'idea'
task blah{
  // do something
}
idea{
  // some stuff
  dependsOn blah
}

and I'm getting this:

Could not find method dependsOn() for arguments [task ':blah'] on root project ...

I can't figure out what the right syntax is. Any help?

like image 470
Giovanni Botta Avatar asked Feb 26 '14 21:02

Giovanni Botta


People also ask

How do I add a dependency to Gradle?

To add a dependency to your project, specify a dependency configuration such as implementation in the dependencies block of your module's build. gradle file. This declares a dependency on an Android library module named "mylibrary" (this name must match the library name defined with an include: in your settings.

How do you update dependencies in build Gradle?

Perform a Gradle sync/reloadThe file versions. properties is part of the Gradle build. Consequently, after you have edited it, you need to ensure the IDE gets the changes. Android Studio: Run the “Sync Project with Gradle Files” action (via ctrl / cmd + shift + A ), or click the elephant + arrow icon in the toolbar.


1 Answers

This should work:

apply plugin: 'idea'
task blah{
  // do something
}
tasks.idea.dependsOn(blah)
like image 66
evanwong Avatar answered Oct 22 '22 09:10

evanwong