首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Spring-Boot starter测试导入未解决

Spring-Boot starter测试导入未解决
EN

Stack Overflow用户
提问于 2018-07-20 18:09:33
回答 1查看 1.5K关注 0票数 1
代码语言:javascript
运行
复制
import org.springframework.test.context.junit4.SpringRunner;

无法解析测试包Spring Boot版本2.0.3 Gradle版本4.6 JDK 1.8

我正在使用IntelliJ社区版集成开发环境,我的操作系统是ubuntu-16.04

还尝试了:1-导入springframework.boot.test,但这也不起作用2-导航到项目目录并使用终端构建项目

我不喜欢手动导入库。

Gradle脚本:

代码语言:javascript
运行
复制
    buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar {
    baseName = 'gs-spring-boot'
    version =  '0.1.0'
}

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    testCompile("junit:junit")
    testCompile("org.springframework.boot:spring-boot-starter-test")
}
EN

回答 1

Stack Overflow用户

发布于 2018-07-20 18:30:13

语句:testCompile("junit:junit"),不需要

依赖关系:

代码语言:javascript
运行
复制
testCompile('org.springframework.boot:spring-boot-starter-test')

解析以下类:

代码语言:javascript
运行
复制
import org.springframework.test.context.junit4.SpringRunner;
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51440184

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档