---
title: "[maven2] No Java test frameworks found"
author: "agile_boy"
date: "2007-03-01T15:04:12Z"
tags: ["C", "C++", "Java", "junit", "maven"]
categories: ["企业架构"]
slug: "maven2-no-java-test-frameworks-found"
draft: false
lastmod: "2007-03-01T15:04:12Z"
id: 56741
url: "https://agile-boy.iteye.com/blog/56741"
---

还是一个与dependency相关的问题，对于允许junit测试来说，如果设置不当，则会出现 **No Java test frameworks found**  
**比如我的**dependency代码如下：

xml 代码

 

1. &lt;dependency&gt;
2. &lt;groupId&gt;libgroupId&gt;
3. &lt;artifactId&gt;junitartifactId&gt;
4. &lt;version&gt;4.1version&gt;
5. &lt;scope&gt;systemscope&gt;
6. &lt;systemPath&gt;${basedir}/lib/junit-4.1.jarsystemPath&gt;
7. dependency&gt;

结果允许mvn test时候如下如下提示

java 代码

1. \[ERROR] BUILD ERROR
2. \[INFO] ------------------------------------------------------------------------
3. \[INFO] No Java test frameworks found
4. \[INFO] ------------------------------------------------------------------------

  而如果将&lt;groupId&gt;libgroupId&gt; =》 &lt;groupId&gt;junitgroupId&gt;，则测试正常运行。

  由此可得出，运行junit所需**groupId artifactId**都是要设置正确

  详细参考[maven.apache.org/plugins/maven-surefire-plugin/usage.html](http://maven.apache.org/plugins/maven-surefire-plugin/usage.html)