Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

gradle

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

  • What I want - I want to build the applications as it's done in the book, using Gradle
  • What is the problem - I have never used Gradle before and when I try to execute what I'm thinking I have to I get this error Task 'build' not found in root project
  • What have I done so far - Yesterday I downloaded Gradle from the official site and get it to work. Today when I actually tried to execute the steps from the book it turns out that the sample code comes with its own Gradle distribution and I executed it which I think followed to getting a second distribution of Gradle. However, I don't know if this may be a problem or not. now my directory with the sample code looks like this: enter image description here

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

  • What have I tried - The only thing that came to my mind was to leave only the Gradle's stuff plus the appendixA-bookstore folder in case Gradle recognize all directories as different builds but no success.
  • What's the final result that I want to accomplish - First I want to figure out where is my mistake and how to build the sample application(s). And also it would be perfect if I actually can do this from my first Gradle setup which as I wrote did yesterday and what exactly should I do to use this sample code with my fresh and original Gradle setup?
like image 961
Leron_says_get_back_Monica Avatar asked Dec 30 '12 17:12

Leron_says_get_back_Monica


2 Answers

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.

like image 138
JB Nizet Avatar answered Sep 20 '22 01:09

JB Nizet


run

gradle clean  

then try

gradle build  

it worked for me

like image 31
Mani Avatar answered Sep 22 '22 01:09

Mani