Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 我的Maven项目如何在没有TestNG尝试运行JUnit测试的情况下同时运行JUnit和TestNG?_Java_Maven_Junit_Testng_Maven Surefire Plugin - Fatal编程技术网

Java 我的Maven项目如何在没有TestNG尝试运行JUnit测试的情况下同时运行JUnit和TestNG?

Java 我的Maven项目如何在没有TestNG尝试运行JUnit测试的情况下同时运行JUnit和TestNG?,java,maven,junit,testng,maven-surefire-plugin,Java,Maven,Junit,Testng,Maven Surefire Plugin,我有一个Maven项目,其中我需要执行JUnit和TestNG测试。Mypom.xml设置了Maven Surefire插件,如下所示: <!-- ... --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</

我有一个Maven项目,其中我需要执行JUnit和TestNG测试。My
pom.xml
设置了Maven Surefire插件,如下所示:

<!-- ... -->
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.19.1</version>
  <configuration>
    <argLine>-Xmx1024m</argLine>
    <threadCount>1</threadCount>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>org.apache.maven.surefire</groupId>
      <artifactId>surefire-testng</artifactId>
      <version>2.19.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.surefire</groupId>
      <artifactId>surefire-junit47</artifactId>
      <version>2.19.1</version>
    </dependency>
  </dependencies>
</plugin>
<!-- ... -->

如何防止此异常污染我的日志?

我想我会分享我的答案,因为我花了一点时间才弄清楚,我的特定问题与遇到此特定堆栈跟踪的其他人的问题有所不同

解决方案是将以下XML元素添加到
pom.XML
文件中的Surefire配置中

<configuration>
  <!-- pre-existing config -->
  <properties>
    <property>
      <name>junit</name>
      <value>false</value>
    </property>
  </properties>
</configuration>

朱尼特
假的
这将在中进一步记录

<configuration>
  <!-- pre-existing config -->
  <properties>
    <property>
      <name>junit</name>
      <value>false</value>
    </property>
  </properties>
</configuration>