我正试图在eclipse中建立一个项目。然后我收到了以下错误。
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':classpath'.
> Artifact 'junit:junit:4.8.2@jar' not found.
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':classpath'.
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.wrapException(ErrorHandlingArtifactDependencyResolver.java:49)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.access$000(ErrorHandlingArtifactDependencyResolver.java:27)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver$ErrorHandlingResolvedConfiguration.getFiles(ErrorHandlingArtifactDependencyResolver.java:82)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:463)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:202)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getFiles(Unknown Source)
at org.gradle.api.internal.initialization.DefaultScriptHandler.updateClassPath(DefaultScriptHandler.java:36)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:118)
at org.gradle.configuration.BuildScriptProcessor.evaluate(BuildScriptProcessor.java:38)
at org.gradle.configuration.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:43)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:466)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:77)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:23)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:21)
at org.gradle.api.internal.Actions$CompositeAction.execute(Actions.java:78)
at org.gradle.api.internal.Actions$TransformingActionAdapter.execute(Actions.java:130)
at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:442)
at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:437)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:40)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.getBuildAnalysis(DefaultGradleLauncher.java:92)
at org.gradle.tooling.internal.provider.BuildModelAction.run(BuildModelAction.java:70)
at org.gradle.tooling.internal.provider.DelegatingBuildModelAction.run(DelegatingBuildModelAction.java:44)
at org.gradle.tooling.internal.provider.ConfiguringBuildAction.run(ConfiguringBuildAction.java:98)
at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:42)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:70)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:68)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:68)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:59)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:45)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator.runCommand(DaemonStateCoordinator.java:186)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:36)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:48)
at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.handleCommand(DefaultIncomingConnectionHandler.java:155)
at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.receiveAndHandleCommand(DefaultIncomingConnectionHandler.java:128)
at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.run(DefaultIncomingConnectionHandler.java:116)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
Caused by: org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ArtifactNotFoundException: Artifact 'junit:junit:4.8.2@jar' not found.
at org.gradle.api.internal.artifacts.ivyservice.DefaultBuildableArtifactResolveResult.notFound(DefaultBuildableArtifactResolveResult.java:38)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.resolve(ExternalResourceResolver.java:494)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ExternalResourceResolverAdapter.resolve(ExternalResourceResolverAdapter.java:39)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CacheLockingModuleVersionRepository$2.run(CacheLockingModuleVersionRepository.java:58)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:179)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:232)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:142)
at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.longRunningOperation(DefaultCacheLockingManager.java:49)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CacheLockingModuleVersionRepository.resolve(CacheLockingModuleVersionRepository.java:56)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LocalModuleVersionRepository.resolve(LocalModuleVersionRepository.java:35)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.IvyContextualiser$1.invoke(IvyContextualiser.java:44)
at $Proxy21.resolve(Unknown Source)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain$ModuleVersionRepositoryArtifactResolverAdapter.resolve(UserResolverChain.java:164)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver$ErrorHandlingArtifactResolver.resolve(LazyDependencyToModuleResolver.java:62)
at org.gradle.api.internal.artifacts.ivyservice.ResolvedArtifactFactory$1$1.create(ResolvedArtifactFactory.java:39)
at org.gradle.api.internal.artifacts.ivyservice.ResolvedArtifactFactory$1$1.create(ResolvedArtifactFactory.java:36)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:124)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:130)
at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:53)
at org.gradle.api.internal.artifacts.ivyservice.ResolvedArtifactFactory$1.create(ResolvedArtifactFactory.java:36)
at org.gradle.api.internal.artifacts.ivyservice.ResolvedArtifactFactory$1.create(ResolvedArtifactFactory.java:34)
at org.gradle.api.internal.artifacts.DefaultResolvedArtifact.getFile(DefaultResolvedArtifact.java:120)
at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration.getFiles(DefaultLenientConfiguration.java:126)
at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration.getFilesStrict(DefaultLenientConfiguration.java:101)
at org.gradle.api.internal.artifacts.ivyservice.DefaultResolvedConfiguration.getFiles(DefaultResolvedConfiguration.java:45)
at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver$FilesAggregatingResolvedConfiguration.getFiles(SelfResolvingDependencyResolver.java:79)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver$ErrorHandlingResolvedConfiguration.getFiles(ErrorHandlingArtifactDependencyResolver.java:80)
... 59 more
BUILD FAILED
Total time: 0.613 secs
但我在gradle和maven存储库中有junit 4.8.2 jar,我也将它添加到项目的构建类路径中。现在每当我打开eclipse时,我在构建之前都会遇到以下错误。
Error while initializing classpath container
Artifact 'junit:junit:4.8.2@jar' not found.
Could not fetch model of type 'EclipseProject' using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.4-bin.zip'.
的build.gradle
./*
* Copyright 2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply from: "$rootDir/gradle/maven.gradle"
dependencies {
compile "junit:junit:$junitVersion"
compile "log4j:log4j:$log4jVersion"
compile "org.slf4j:slf4j-api:$slf4jVersion"
compile "com.fasterxml.jackson.core:jackson-core:$jacksonCoreVersion"
compile "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion"
compile "com.hazelcast:hazelcast:$hazelcastVersion"
compile "io.netty:netty-all:$nettyVersion"
}
artifacts {
platform jar
}
test {
outputs.upToDateWhen { false }
testLogging.showStandardStreams = true
systemProperty 'vertx.test.timeout', 60
jvmArgs '-server', '-Xms128m', '-Xmx1024m', '-XX:MaxPermSize=128m', '-XX:NewRatio=2'
testLogging { exceptionFormat "full" }
}
答案 0 :(得分:1)
您当地的回购邮件可能已损坏。 尝试从本地仓库卸载junit并重新下载。
rm -rf ~/.m2/repository/junit
答案 1 :(得分:0)
根据您提供的信息,我最好的猜测是问题与buildscript
或其他构建脚本中的maven.gradle
部分有关。例如,您可能在那里缺少存储库声明。为了排除问题与Eclipse(集成)有关,我首先尝试在命令行上构建项目(例如gradle clean build --refresh-dependencies
)。