[maven2] No Java test frameworks found
还是一个与dependency相关的问题,对于允许junit测试来说,如果设置不当,则会出现 No Java test frameworks found
比如我的dependency代码如下:
xml 代码
- <dependency>
- <groupId>libgroupId>
- <artifactId>junitartifactId>
- <version>4.1version>
- <scope>systemscope>
- <systemPath>${basedir}/lib/junit-4.1.jarsystemPath>
- dependency>
结果允许mvn test时候如下如下提示
java 代码
- [ERROR] BUILD ERROR
- [INFO] ------------------------------------------------------------------------
- [INFO] No Java test frameworks found
- [INFO] ------------------------------------------------------------------------
而如果将<groupId>libgroupId> =》 <groupId>junitgroupId>,则测试正常运行。
由此可得出,运行junit所需groupId artifactId都是要设置正确
详细参考maven.apache.org/plugins/maven-surefire-plugin/usage.html
对于center repository来说,绝对正确 :)
在C:\Documents and Settings\Administrator.m2(默认情况)下有你整个maven下载下来的jar包的目录结构,junit的如下:C:\Documents and Settings\Administrator.m2\repository\junit\junit\3.8.1,注意junit\junit\3.8.1,依次为:groupId,artifactId,version,照着这个设置就可以了!