本文介绍了无法运行gradlew的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 apply plugin:'java'来设置 build.gradle 文件。我尝试使用的说明设置一个gradle包装器,但是当我键入 sudo ./ gradlew build ,我得到一个错误 sudo:./gradlew:command not found 。当我键入 gradle build 时,项目生成良好。这只是gradlew,不工作。

我甚至试过 sudo chmod + x gradlew 但它没有工作。我使用Fedora 20,64位和Gradle版本1.10。

I've setup a build.gradle file with apply plugin: 'java'. I tried setting up a gradle wrapper using the instructions here, but when I type sudo ./gradlew build, I get an error sudo: ./gradlew: command not found. When I type gradle build, the project builds fine. It's just gradlew that isn't working.
I even tried sudo chmod +x gradlew but it didn't work. I'm using Fedora 20, 64 bit and gradle version 1.10.

推荐答案

好的,解决方案是运行 gradlew 在Linux分区上。不知何故,当我从安装在Linux中的Windows分区运行它时,即使运行 chmod 777 gradlew ,该文件也无法获得执行权限。当我将项目复制到Linux文件系统并运行它时,它工作正常(设置了执行权限后)。

Ok so the solution was to run gradlew on the Linux partition itself. Somehow, when I ran it from a Windows partition mounted in Linux, the file couldn't get execute permissions even though I ran chmod 777 gradlew. When I copied the project into the Linux filesystem and ran it, it worked fine (after setting execute permission for it).

这篇关于无法运行gradlew的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 02:56