java-Gradle搜索常春藤服务,但未定义常春藤配置回购

java-Gradle搜索常春藤服务,但未定义常春藤配置回购,第1张

概述我从Gradle中收到以下错误Couldnotresolvealldependenciesforconfiguration':unitTestCompile'.>Couldnotfindjunit:junit:4.11. 这是我的build.gradleapplyplugin:'android-library'buildscript{repositories{mavenCentr

我从Gradle中收到以下错误

Could not resolve all dependencIEs for configuration ':unitTestCompile'.> Could not find junit:junit:4.11.

 

这是我的build.gradle

apply plugin: 'android-library'buildscript {    repositorIEs {        mavenCentral()    }    dependencIEs {        classpath 'com.androID.tools.build:gradle:0.8.+'    }}version = '0.6.2'configurations {        unitTestCompile.extendsFrom runtime        unitTestRuntime.extendsFrom unitTestCompile}dependencIEs {    compile files('libs/androID-support-v4.jar')    unitTestCompile 'junit:junit:4.11'}androID {    buildToolsversion "19.0.1"    compileSdkVersion 17     sourceSets {        main {            manifest.srcfile 'AndroIDManifest.xml'            java.srcDirs = ['src', 'bundled-src']            resources.srcDirs = ['src']            aIDl.srcDirs = ['src']            renderscript.srcDirs = ['src']            res.srcDirs = ['res']            assets.srcDirs = ['assets']        }    }    dependencIEs {        compile filetree(dir: './libs', include: 'Amplitude.jar')    }}sourceSets {        unitTest {                java.srcDirs = ['tests/src']                res.srcDirs = ['tests/res']                assets.srcDirs = ['tests/assets']                resources.srcDirs = ['tests/res']        }}task doUnitTest(type:Test, dependsOn: assemble) {        description = "run unit tests"        testClassesDir = project.sourceSets.unitTest.output.classesDir        classpath = project.sourceSets.unitTest.runtimeClasspath}check.dependsOn doUnitTest

调试运行表明它正在尝试使用Ivy而不是Maven解决依赖关系?

16:21:58.633 [DEBUG] [org.gradle.API.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Visiting configuration :analytics-androID:0.6.2(unitTestCompile).16:21:58.633 [DEBUG] [org.gradle.API.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Visiting dependency :analytics-androID:0.6.2(unitTestCompile) -> junit:junit:4.11(dependency: junit#junit;4.11 {unitTestCompile=[default]})16:21:58.634 [DEBUG] [org.gradle.API.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Selecting new module version junit:junit:4.1116:21:58.634 [DEBUG] [org.gradle.API.internal.artifacts.ivyservice.ivyresolve.UserResolverChain] Attempting to resolve module 'junit:junit:4.11' using repositorIEs []16:21:58.636 [DEBUG] [org.gradle.API.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Attaching :analytics-androID:0.6.2(unitTestCompile) to its parents.16:21:58.637 [DEBUG] [org.gradle.API.internal.artifacts.ivyservice.resolveengine.oldresult.TransIEntConfigurationResultsBuilder] Flushing resolved configuration data in Binary store in /private/var/folders/7y/yrtq1vcx3xb901v_xd5v5_100000gn/T/gradle1413382664789288993.bin. Wrote root :analytics-androID:0.6.2:unitTestCompile.16:21:58.638 [DEBUG] [org.gradle.API.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':compileUnitTestJava'16:21:58.638 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :compileUnitTestJava (Thread[main,5,main]) completed. Took 0.017 secs.16:21:58.639 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[main,5,main]] finished, busy: 4.035 secs, IDle: 0.047 secs16:21:58.644 [ERROR] [org.gradle.BuildExceptionReporter] 16:21:58.645 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build Failed with an exception.16:21:58.645 [ERROR] [org.gradle.BuildExceptionReporter] 16:21:58.646 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:16:21:58.646 [ERROR] [org.gradle.BuildExceptionReporter] Could not resolve all dependencIEs for configuration ':unitTestCompile'.16:21:58.646 [ERROR] [org.gradle.BuildExceptionReporter] > Could not find junit:junit:4.11.16:21:58.646 [ERROR] [org.gradle.BuildExceptionReporter]   required by:16:21:58.647 [ERROR] [org.gradle.BuildExceptionReporter]       :analytics-androID:0.6.2

解决方法:

问题在于,您仅声明了构建脚本依赖项的存储库,而没有声明常规依赖项的存储库. (换句话说,您需要一个顶级存储库块.)此外,依赖项块应始终位于androID块之外,因为它是Gradle的核心功能,与AndroID插件无关.

总结

以上是内存溢出为你收集整理的java-Gradle搜索常春藤服务,但未定义常春藤配置/回购全部内容,希望文章能够帮你解决java-Gradle搜索常春藤服务,但未定义常春藤配置/回购所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1211338.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-04
下一篇 2022-06-04

发表评论

登录后才能评论

评论列表(0条)

保存