【发布时间】:2018-06-30 17:30:15
【问题描述】:
在我尝试将AssertJ 库添加到我的项目进行测试后,我的项目中的一些配置发生了更改,我无法将任何类从我的 main 包导入到我的 JUnit test 包。
我的主类按预期运行,但我无法运行任何需要主包中的类的测试。
我尝试了以下方法:
- 删除 AssertJ 导入
- 重建项目
- 刷新所有 Gradle 项目
- 使 IntelliJ 缓存无效并从设置重新启动
- 在本地删除项目并从 GitHub 重新下载
- 删除测试目录并重新添加
查看另一个正在运行的项目,这似乎是我的 build.gradle 文件
的问题group 'carpecoin'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.2.41'
ext.junitJupiterVersion = '5.0.3'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.3'
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testImplementation group: 'junit', name: 'junit', version: '4.12'
// JUnit Jupiter API and TestEngine implementation
testCompile("org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}")
testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")
// To avoid compiler warnings about @API annotations in JUnit code
testCompileOnly('org.apiguardian:apiguardian-api:1.0.0')
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
implementation 'io.reactivex.rxjava2:rxjava:2.1.1'
implementation 'com.google.firebase:firebase-admin:6.0.0'
implementation 'com.google.firebase:firebase-database:15.0.0'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
【问题讨论】:
标签: java android firebase intellij-idea kotlin