Leron
Leron

Reputation: 9886

Trying Gradle build - "Task 'build' not found in root project"

I just started reading "Pro Spring MVC with web flow" and it comes with a code sample that I want to follow.

Then it's written that I have to execute ../gradlew build which I execute like this and get the following: enter image description here

Upvotes: 50

Views: 304304

Answers (4)

MadhaviJ
MadhaviJ

Reputation: 11

If you are using gradle 7.5.1 then you need to run the command as

$ gradle tasks <taskname>

So in your case the task name would be the one found under chapter folders.

Upvotes: 1

Igor Guk
Igor Guk

Reputation: 61

Check your file: settings.gradle for presence lines with included subprojects (for example: include chapter1-bookstore )

Upvotes: 6

Mani
Mani

Reputation: 634

run

gradle clean 

then try

gradle build 

it worked for me

Upvotes: 13

JB Nizet
JB Nizet

Reputation: 692181

You didn't do what you're being asked to do.

What is asked:

I have to execute ../gradlew build

What you do

cd ..
gradlew build

That's not the same thing.

The first one will use the gradlew command found in the .. directory (mdeinum...), and look for the build file to execute in the current directory, which is (for example) chapter1-bookstore.

The second one will execute the gradlew command found in the current directory (mdeinum...), and look for the build file to execute in the current directory, which is mdeinum....

So the build file executed is not the same.

Upvotes: 40

Related Questions