Java gradle testCompile不';无法解决依赖关系
我有如下小型gradle项目:Java gradle testCompile不';无法解决依赖关系,java,gradle,junit,Java,Gradle,Junit,我有如下小型gradle项目: buildscript { ext { springBootVersion = '1.3.5.RELEASE' } repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
buildscript {
ext {
springBootVersion = '1.3.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'spring-boot'
jar {
baseName = 'web'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-actuator-docs')
compile('org.springframework.boot:spring-boot-starter-amqp')
compile('org.springframework.boot:spring-boot-starter-cache')
compile('org.springframework.cloud:spring-cloud-starter-oauth2:1.1.0.RELEASE')
compile('org.springframework.boot:spring-boot-devtools')
compile('org.springframework.boot:spring-boot-starter-mail')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-social-facebook')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-websocket')
compile('org.activiti:activiti-spring-boot-starter-basic')
compile('org.springframework.boot:spring-boot-starter-data-mongodb')
compile('org.activiti:activiti-spring-boot-starter-basic:5.19.0')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
runtime('mysql:mysql-connector-java')
testCompile('junit:junit:4.12')
testCompile("org.springframework.boot:spring-boot-starter-test:1.3.5.RELEASE")
testCompile('org.springframework:spring-test')
}
在完整构建期间,我遇到以下错误:
:compileJava
:processResources UP-TO-DATE
:classes
:findMainClass
:jar
:bootRepackage
:assemble
:compileTestJava
D:\Max\java\agreit\web\src\test\java\com\agreit\WebApplicationTests.java:5: error: package org.springframework.boot.test.context does not exist
import org.springframework.boot.test.context.SpringBootTest;
^
D:\Max\java\agreit\web\src\test\java\com\agreit\WebApplicationTests.java:6: error: cannot find symbol
import org.springframework.test.context.junit4.SpringRunner;
^
symbol: class SpringRunner
location: package org.springframework.test.context.junit4
D:\Max\java\agreit\web\src\test\java\com\agreit\WebApplicationTests.java:10: error: cannot find symbol
@SpringBootTest
^
symbol: class SpringBootTest
D:\Max\java\agreit\web\src\test\java\com\agreit\WebApplicationTests.java:9: error: cannot find symbol
@RunWith(SpringRunner.class)
^
symbol: class SpringRunner
4 errors
:compileTestJava FAILED
在
.gradle
缓存中,我可以看到spring-boot-starter-test-1.3.5.RELEASE.jar,但是这个文件不包含任何类。将您的“testCompile”(“org.springframework.boot:spring-boot-starter-test:1.3.5.RELEASE”)行更改为testCompile组:“org.springframework.boot.boot”,名称:“spring-boot-starter-test”,版本:“1.3.5.RELEASE”
是否可能是用于spring boot starter测试的testCompile()中的双引号?这是唯一吸引我眼球的东西,其余的看起来很好,应该work@hd1没有work@Dewfy如果单引号不起作用,您能告诉我们您使用的是哪个版本的gradle吗?添加版本1.4.1.0下载了依赖项。甜心:-)