Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
417 views
in Technique[技术] by (71.8m points)

java - Gradle eclipse plugin : Could not find method jcenter() for arguments [] on repository container. See error log for details

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...