在mvn clean test执行报:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project hello: Compilation failure: Compilation failure:
[ERROR] /D:/mavenWork/src/test/java/com/clc/helloworld/test/TestHelloworld.java:[2,17] 程序包org.junit不存在
[ERROR] /D:/mavenWork/src/test/java/com/clc/helloworld/test/TestHelloworld.java:[4,10] 找不到符号
但是测试mvn clean compile是没问题的 ,解决办法(更改junit的依赖):
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
改为(删去<scope>test</scope>):
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>