在IntelliJ中运行单元测试时出现以下错误: 错误:找不到或加载主类$ {surefireArgLine}. 我正在使用maven,在pom.xml中有:
I get the following error when running Unit tests in IntelliJ: Error: Could not find or load main class ${surefireArgLine}. I am using maven and in pom.xml I have:
<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> ...有人有类似的问题吗?如何为surefireArgLine设置值?
Did anyone have similiar problem? How to set value for surefireArgLine?
推荐答案我遇到了同样的问题,我认为我在顶点问题跟踪器.
I had the same problem and i think i found the solution on the vertx-issue tracker.
简而言之,您必须将IntelliJ Maven(surefire插件)集成配置为不同的行为.
In short you have to configure your IntelliJ Maven (surefire plugin) integration to behave differently.
通过以下方式执行此操作: Preferences -> Build,Execution,Deployment -> Build Tools -> Maven -> Running Tests
Do this via: Preferences -> Build,Execution,Deployment -> Build Tools -> Maven -> Running Tests
取消选中argLine
这在IntelliJ 14.1.6和mvn 3.3.9中对我有效
This works for me in IntelliJ 14.1.6 with mvn 3.3.9
更多推荐
运行单元测试时出现IntelliJ错误:无法找到或加载主类$ {surefireArgLine}
发布评论