Pergunta

When I run my gradle task test, why are the tasks local, dev, and uat seem to be run as well? I am trying to only run test.

The actual output when I run gradle test is below (see pic). My desired output is below (see pic). What am I doing wrong in my code? I am new to Gradle/Groovy, so my apologies. thanks!

Code: Gradle Code of build.gradle file

Actual Output: Command line output when running "gradle test"

Desired Output: Output I wish I had

Foi útil?

Solução

When you use

someTask {
    someMethod()
}

then it means to gradle that it must call someMethod() when configuring the task, in the first phase that parses the build script and decides which tasks exist and what depends on what.

To define what must happen when the task is executed, in the second phase, you must use the following syntax:

someTask << {
    someMethod()
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top