我已经使用brew安装了gradle。 brew install gradle
。但是,安装有问题。每当我尝试运行gradle时,例如只运行$ gradle
或$ gradle -q tasks
或我得到的任何内容:
FAILURE: Build failed with an exception.
* What went wrong:
org.apache.commons.io.FileUtils.deleteQuietly(Ljava/io/File;)Z
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
使用堆栈跟踪运行会产生以下输出:
FAILURE: Build failed with an exception.
* What went wrong:
org.apache.commons.io.FileUtils.deleteQuietly(Ljava/io/File;)Z
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.deleteQuietly(Ljava/io/File;)Z
at org.gradle.internal.nativeintegration.filesystem.services.GenericFileSystem.<init>(GenericFileSystem.java:89)
at org.gradle.internal.nativeintegration.filesystem.services.FileSystemServices.createFileSystem(FileSystemServices.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.internal.service.DefaultServiceRegistry.invoke(DefaultServiceRegistry.java:426)
at org.gradle.internal.service.DefaultServiceRegistry.access$1200(DefaultServiceRegistry.java:61)
at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:739)
at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:695)
at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectProvider.getInstance(DefaultServiceRegistry.java:537)
at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.get(DefaultServiceRegistry.java:577)
at org.gradle.internal.service.DefaultServiceRegistry.doGet(DefaultServiceRegistry.java:393)
at org.gradle.internal.service.DefaultServiceRegistry.get(DefaultServiceRegistry.java:374)
at org.gradle.internal.nativeintegration.services.FileSystems.getDefault(FileSystems.java:22)
at org.gradle.api.internal.file.IdentityFileResolver.<init>(IdentityFileResolver.java:29)
at org.gradle.launcher.daemon.configuration.DaemonParameters.<init>(DaemonParameters.java:43)
at org.gradle.launcher.daemon.configuration.DaemonParameters.<init>(DaemonParameters.java:52)
at org.gradle.launcher.cli.Parameters.<init>(Parameters.java:31)
at org.gradle.launcher.cli.BuildActionsFactory.createAction(BuildActionsFactory.java:56)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.createAction(CommandLineActionFactory.java:242)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:232)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
$ gradle -v
是唯一有效的命令:
------------------------------------------------------------
Gradle 2.9
------------------------------------------------------------
Build time: 2015-11-17 07:02:17 UTC
Build number: none
Revision: b463d7980c40d44c4657dc80025275b84a29e31f
Groovy: 2.4.4
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.8.0_74 (Oracle Corporation 25.74-b02)
OS: Mac OS X 10.11.3 x86_64
有人可以建议为什么会这样吗?我错过了一些依赖项吗?
我尝试过多次重新安装。甚至安装了android工具的gradle。
的build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
}
}
答案 0 :(得分:0)
显然我在org.apache.commons.io
中有一个过时的Library/Java/Extensions
版本。我只是用新版本替换它,它的工作原理。
不确定我是否需要Library/Java/Extensions
中的某些内容。