build.gradle - How to execute task in Gradle? -


i have following project structure:

  • application
    • build.gradle
  • build.gradle
  • settings.gradle

application/build.gradle:

apply plugin: 'java' 

settings.gradle:

include ':application' 

build.gradle:

task custom << {   project.tasks.getbyname("build").execute() } 

so want execute task "build" inside task "custom". when run "gradle custom" result is:

:custom failed  failure: build failed exception.  * where: build file '/tmp/test/build.gradle' line: 3  * went wrong: execution failed task ':custom'. > task name 'build' not found in root project 'test'.  * try: run --stacktrace option stack trace. run --info or --debug option more log output.  build failed  total time: 1.183 secs 

how can execute task "build" inside task "custom" ?

you cannot. task execution declarative, not imperative. tasks depend on each other, not execute each other. (also, since don't apply java (base) plugin in root build script, root project doesn't have build task.)


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -