Blu*_*e16 61 junit intellij-idea maven-surefire-plugin
在IntelliJ中运行单元测试时出现以下错误:错误:无法找到或加载主类$ {surefireArgLine}.我正在使用maven,在pom.xml中我有:
<properties>
...
<surefire.argLine />
</properties>
<build>
<plugins>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<!--Sets the VM argument line used when unit tests are run.-->
<argLine>${surefire.argLine}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.1.201405082137</version>
<executions>
<!--
Prepares the property pointing to the JaCoCo runtime agent which
is passed as VM argument when Maven the Surefire plugin is executed.
-->
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!--Sets the path to the file which contains the execution data.-->
<destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
<!--
Sets the name of the property containing the settings
for JaCoCo runtime agent.
-->
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
...
Run Code Online (Sandbox Code Playgroud)
有没有人有类似的问题?如何设置surefireArgLine的值?
jah*_*jah 204
我有同样的问题,我想我在vertx-issue跟踪器上找到了解决方案.
简而言之,您必须配置IntelliJ Maven(surefire插件)集成以使其表现不同.
这样做是通过:
Preferences -> Build,Execution,Deployment -> Build Tools -> Maven -> Running Tests
取消选中 argLine
这适用于IntelliJ 14.1.6和mvn 3.3.9
通过将surefire-plugin版本更改为2.10并删除,我能够在Netbeans中修复此错误
<argLine>-Xmx1024m -XX:MaxPermSize=256m ${argLine}</argLine>
Run Code Online (Sandbox Code Playgroud)
来自maven-surefire-plugin配置.相反,我创建了一个属性argLine,由surefire自动选取.
<properties>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
</plugin>
Run Code Online (Sandbox Code Playgroud)
现在,我可以运行和调试单个文件和测试方法.代码覆盖率正如预期的那样工作.
| 归档时间: |
|
| 查看次数: |
34108 次 |
| 最近记录: |