尝试Gradle构建 - 在根项目中找不到“任务”构建“ [英] Trying Gradle build - "Task 'build' not found in root project"

查看:150
本文介绍了尝试Gradle构建 - 在根项目中找不到“任务”构建“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始阅读Pro Spring MVC with web flow,它附带了我想要遵循的代码示例。




  • 我想要的东西 - 我想按照本书所做的那样构建应用程序,使用 Gradle

  • 问题是什么 - 我从来没有用过 Gradle 在尝试执行我在想什么时,我必须得到此错误未在根项目中找到任务'build'

  • 我到目前为止做了什么 - 昨天我从官方网站上下载了 Gradle 并让它工作。今天,当我真的试图执行书中的步骤时,事实证明,示例代码带有它自己的Gradle发行版,并执行了它,我认为它遵循了获得Gradle的第二个发行版。不过,我不知道这可能是一个问题或不。现在我的示例代码如下所示:



  • 然后写出我必须执行这样执行的 ../ gradlew build ,并且得到以下内容:




    • 我试过了什么 - 我唯一想到的就是只留下Gradle的东西加上 appendixA-bookstore code>文件夹,以防Gradle将所有目录识别为不同的构建,但不成功。

    • 我想完成的最终结果是什么 - 首先我想fo找出我的错误在哪里以及如何构建示例应用程序。如果我真的可以从我的第一个 Gradle 设置中执行此操作(这是我昨天写的),我应该如何使用此示例代码和原始的Gradle设置?


    解决方案



    提问:


    我必须执行../ gradlew build


    你做什么

      cd .. 
    gradlew build

    这不是一回事。

    第一个将使用在 .. 目录中找到的gradlew命令( mdeinum ... ),并查找要在当前目录(例如 chapter1-bookstore )中执行的构建文件。 p>

    第二个将执行在当前目录( mdeinum ... )中找到的gradlew命令,然后查找构建要在当前目录中执行的文件,该文件是 mdeinum ...

    因此,执行的构建文件是不一样。


    I just started to read "Pro Spring MVC with web flow" and it comes with a code sample which 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 work. Today when I actually tried to execute the steps from the book it turns out that the sample code comes with it's own Gradle distribution and I executed it which I think followed to getting a second distrib 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:

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

    • 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 fo 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?

    解决方案

    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.

    这篇关于尝试Gradle构建 - 在根项目中找不到“任务”构建“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆