Java 我的Maven项目如何在没有TestNG尝试运行JUnit测试的情况下同时运行JUnit和TestNG?
我有一个Maven项目,其中我需要执行JUnit和TestNG测试。MyJava 我的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</
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>