Reputation: 2438
I am having a issue with simple project's junit in Intellij Idea.
Gradle (2.10) can run the junits from command line. Import the project to Intellij Idea 15.0.3, try to run the JUnit in intellij it throws compile errors as if the junit is not on the classpath. Error:(1, 17) java: package org.junit does not exist
checked the project structure the junit lib is there, also tried the other method adivised - create Test in Intellij 'Goto Test > create new Test >' still not much luck.
build.gradle:
allprojects {
apply plugin: 'idea'
apply plugin: 'java'
sourceCompatibility = 1.7
group 'junit.fail'
version '1.0'
repositories {
mavenCentral()
}
}
subprojects {
dependencies {
testCompile 'junit:junit:4.12'
}
}
dependencies {
compile project(':common')
compile project(':modA')
}
settings.gradle
rootProject.name = 'junit-fail'
include 'common'
include 'modA'
Simple code in module common
junit-fail\common\src\main\java
public class ClassA {
public String getA() {
return "A";
}
}
junit-fail\common\src\test\java
import org.junit.Test;
import static org.junit.Assert.*;
public class ClassATest {
@Test
public void testGetA() throws Exception {
ClassA a = new ClassA();
assertEquals("A", a.getA());
}
}
modA can have the similar test code.
Upvotes: 1
Views: 392
Reputation: 2438
Able to resolve the issue by moving .gradle from c:\users\ to c:\dev JDK8 was ok but JDK7 never worked - my home dir is network synced. so that may have been an issue.
Upvotes: 0