本文介绍了Gradle eclipse插件:找不到存储库容器中参数[]的方法jcenter()。详细信息请参阅错误日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 找不到方法jcenter()for在资源库容器上的arguments []。有关详细信息,请参阅错误日志

其中,我的 build.gradle 包含以下内容:

  buildscript {
repositories {
jcenter()
}
依赖关系{
classpath'org.gradle.api.plugins:gradle-cargo-plugin:1.1'
}
}

eclipse日志包含以下内容(仅为简短发布尾部):

 导致:org.gradle.api.internal.MissingMethodException:找不到存储库容器中参数[]的方法jcenter()。 
在org.gradle.api.internal.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:68)
在org.gradle.api.internal.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:56)
在org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:172)
在org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler_Decorated.invokeMethod(未知来源)
在build_21nipivver1ec19jnvd93lc92o $ _run_closure1_closure2.doCall(/home/alok/cxps/dev/Seer-Clari5.4.X-baseline/workspace/AML/build.gradle:3)
在org.gradle.api.internal.ClosureBackedAction.execute( ClosureBackedAction.java:58)
在org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:133)
在org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:113)
在org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.configure(DefaultArtifactRepositoryContainer.java:76)
在org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContai在org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:50)
$ org.gradle.util.ConfigureUtil.configure(ConfigureUtil) java:133)
在org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:94)
在org.gradle.api.internal.initialization.AbstractScriptHandler.repositories(AbstractScriptHandler.java:66)
在build_21nipivver1ec19jnvd93lc92o $ _run_closure1.doCall(/home/alok/cxps/dev/Seer-Clari5.4.X-baseline/workspace/AML/build.gradle:2)
在org.gradle.api .internal.ClosureBackedAction.execute(ClosureBackedAction.java:58)
在org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:133)
在org.gradle.util.ConfigureUtil.configure(ConfigureUtil .java:94)
在org.gradle.api.internal.project.AbstractProject.buildscript(AbstractProject.java:893)
在org.gradle.api.Project $ buildscript.call(未知来源)
在org.gradle.api.internal.project.ProjectScript.buildscript(Proj ectScript.groovy:42)
在org.gradle.api.Script $ buildscript.callCurrent(未知来源)
在build_21nipivver1ec19jnvd93lc92o.run(/home/alok/cxps/dev/Seer-Clari5.4。 X-baseline / workspace / AML / build.gradle:1)
在org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory $ ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
... 53更多

这是一个eclipse插件问题吗?请求,因为这在命令行以及intelliJ上正常工作。

解决方案

听起来像您的Eclipse配置了一个较老的Gradle版本还没有一个 jcenter 方法。确保使用Gradle Wrapper进行构建,并在导入Eclipse时选择使用Gradle Wrapper。


I am trying to import my gradle project into eclipse and I get the error

Could not find method jcenter() for arguments [] on repository container. See error log for details

Among other things, my build.gradle contains the following:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'org.gradle.api.plugins:gradle-cargo-plugin:1.1'
    }
}

The eclipse log contains the following (posting only the tail for brevity):

Caused by: org.gradle.api.internal.MissingMethodException: Could not find method jcenter() for arguments [] on repository container.
at org.gradle.api.internal.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:68)
at org.gradle.api.internal.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:56)
at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:172)
at org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler_Decorated.invokeMethod(Unknown Source)
at build_21nipivver1ec19jnvd93lc92o$_run_closure1_closure2.doCall(/home/alok/cxps/dev/Seer-Clari5.4.X-baseline/workspace/AML/build.gradle:3)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:58)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:133)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:113)
at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.configure(DefaultArtifactRepositoryContainer.java:76)
at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.configure(DefaultArtifactRepositoryContainer.java:44)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:50)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:133)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:94)
at org.gradle.api.internal.initialization.AbstractScriptHandler.repositories(AbstractScriptHandler.java:66)
at build_21nipivver1ec19jnvd93lc92o$_run_closure1.doCall(/home/alok/cxps/dev/Seer-Clari5.4.X-baseline/workspace/AML/build.gradle:2)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:58)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:133)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:94)
at org.gradle.api.internal.project.AbstractProject.buildscript(AbstractProject.java:893)
at org.gradle.api.Project$buildscript.call(Unknown Source)
at org.gradle.api.internal.project.ProjectScript.buildscript(ProjectScript.groovy:42)
at org.gradle.api.Script$buildscript.callCurrent(Unknown Source)
at build_21nipivver1ec19jnvd93lc92o.run(/home/alok/cxps/dev/Seer-Clari5.4.X-baseline/workspace/AML/build.gradle:1)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
... 53 more

Is this an eclipse plugin issue? Asking because this works fine on the command line as well as on intelliJ.

解决方案

Sounds like your Eclipse is configured with an older Gradle version that doesn't yet have a jcenter method. Make sure to use the Gradle Wrapper for the build, and select "use Gradle Wrapper" when importing into Eclipse.

这篇关于Gradle eclipse插件:找不到存储库容器中参数[]的方法jcenter()。详细信息请参阅错误日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 17:39