gradle-release icon indicating copy to clipboard operation
gradle-release copied to clipboard

Task with name 'build' not found in root project gradlebuild_examples'

Open elianfish opened this issue 8 years ago • 19 comments

plugins { id 'net.researchgate.release' version '2.4.0'

}

  • What went wrong: A problem occurred configuring root project 'gradlebuild_examples'.

    Task with name 'build' not found in root project gradlebuild_examples'.

elianfish avatar Jul 26 '16 06:07 elianfish

What buildTasks used for? The following settings are wrong buildTasks = [ 'build'] buildTasks = [ 'assembleRelease']

ERROR:

Task with name 'assembleRelease' not found in root project 'gradlebuild_examples'.

elianfish avatar Jul 27 '16 06:07 elianfish

To tell the plugin which gradle task builds your project. For example in java project the build task creates the jar and also runs the tests.

Hillkorn avatar Aug 01 '16 09:08 Hillkorn

build android project

buildTasks = [ 'app:assembleRelease']

Task with name 'app:assembleRelease' not found in root project 'gradlebuild_examples'.

buildTasks = [ 'app:build']

Task with name 'app:build' not found in root project 'gradlebuild_examples'.

elianfish avatar Aug 04 '16 10:08 elianfish

This is a bug and needs a major change to fix it. As a workaround you could create a task build and add dependsOn to your child project tasks, now buildTasks = [ 'build'] should work and run the other tasks on execution. If the build task is already there you can use a different name or only add the dependsOn to the other tasks.

Hillkorn avatar Feb 01 '17 17:02 Hillkorn

Good day, Has there been any progress on this? I need to build 3 release builds for 3 different flavors. eg. buildTasks = [assemble$feature$flavor]

darrenferreira avatar Apr 05 '17 11:04 darrenferreira

There is no progress yet on this.

Hillkorn avatar Apr 05 '17 12:04 Hillkorn

okay, thank you.

darrenferreira avatar Apr 05 '17 12:04 darrenferreira

+1 to issue, I want to use plugin, but don't want to re-write the code in order to use it =)

tdanylchuk avatar Aug 08 '17 09:08 tdanylchuk

+1 this issue, older version has "Task.leftShift(Closure) method has been deprecated" with gradle 4.1, newer version fails with this error.

bludginozzie avatar Sep 09 '17 01:09 bludginozzie

+1 .

durai89 avatar Oct 19 '17 21:10 durai89

+1

herriojr avatar Oct 23 '17 18:10 herriojr

what is the workaround for an android application? This doesn't seem to work:

buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta7'
    }
}

plugins {
  id 'net.researchgate.release' version '2.4.0'
}

task build {}
build.dependsOn('app:build')
build.dependsOn('lib:build')

release {
    buildTasks=['build']
    ...
}

herriojr avatar Oct 23 '17 18:10 herriojr

What is the output of gradle?

Hillkorn avatar Oct 26 '17 07:10 Hillkorn

classpath 'net.researchgate:gradle-release:2.1.2' seems to work fine but when I update the version to 'net.researchgate:gradle-release:2.4.0' I get Error:Task with name 'build' not found in root project error.

shreknitin89 avatar Oct 26 '17 15:10 shreknitin89

+1 gradle-release 2.6.0

'com.android.tools.build:gradle:3.4.2'

halzhang avatar Aug 15 '19 08:08 halzhang

Hello, I encountered this error too. I'm using gradle 6.8 and I have a multi-project build. I tried the suggested workaround and it worked, however passing the argument -x test to the command line has no effect, and I really would like to exclude the execution of my tests because they are very long and the release should be fast (in my environment, the tests are executed apart).

michaelremond avatar Oct 07 '21 13:10 michaelremond

The reason that it doesn't work is because the release task creates another gradle build with new startParameters. See https://github.com/researchgate/gradle-release/blob/master/src/main/groovy/net/researchgate/release/ReleasePlugin.groovy#L43 If you want to exclude them always or use some other way with properties env etc... you can set the tasks to exclude on task level in your build.gradle. See https://docs.gradle.org/current/javadoc/org/gradle/StartParameter.html#setExcludedTaskNames-java.lang.Iterable-

Hillkorn avatar Oct 07 '21 18:10 Hillkorn

Thank you very much for your reponse @Hillkorn

michaelremond avatar Oct 08 '21 07:10 michaelremond

I thought I understand what to do but I am not a gradle guru. I tried several things to customize the release task or the runBuildTasks (I noticed the same startParameter.newInstance()) task but without success. Basically what I would like to achieve is, if I call gradle release, I would like to exclude the task test. I wonder if I can do that from my build.gradle or if it is only possible from the plugin source.

michaelremond avatar Oct 08 '21 09:10 michaelremond