我对Gradle很新,我想用Gradle下载我所有的测试依赖项。我用gradle init
来生成我的构建文件,并从我以前的脚本中复制了一些依赖关系。但是,在项目根目录中使用gradle --refresh-dependencies
时,测试依赖关系仍然无法下载。Gradle没有下载测试依赖项
我试图寻找答案,为什么发生这种情况,但他们似乎并没有解决我的问题。我的构建文件有问题吗?
特别是,我在下载mockito和hamcrest之后。
构建文件:
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile 'org.slf4j:slf4j-api:1.7.5'
testCompile "junit:junit:4.11"
testCompile "org.mockito:mockito-core:1.9.5"
testCompile "org.hamcrest:hamcrest-library:1.3"
}
test {
testLogging {
events 'started', 'passed'
}
}
task wrapper(type: Wrapper) { gradleVersion = '1.11' }
我也使用Eclipse是否有帮助。
编辑:将Gradle自然添加到我的项目后,它似乎工作。谁能解释为什么?
它似乎仍然没有工作。 – Chad
太含糊了。怎么了? –
现在似乎工作了,在我的项目中添加了Gradle特性后,清理并重新生成了eclipse文件。这是否必要? – Chad