如何配置 maven install 以跳过 eclipse 中的测试?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8923002/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to configure maven install to skip tests in eclipse?
提问by fresh_dev
i was wondering if it's possible to configure run as maven install in eclipse to skip unit tests, if such thing is doable, then please tell me how to do it, thanks in advance.
我想知道是否可以在 Eclipse 中将 run 配置为 maven install 以跳过单元测试,如果这样的事情是可行的,那么请告诉我如何做,在此先感谢。
回答by Tom Elliott
- Ensure Maven is configured for your project
- Right-click on your project
- Go to 'Run As'
- Select 'Run Configurations'
- In the left-hand column, right-click 'Maven Build' and select 'New'
- Select the base directory (the project) you want to build from
- Write 'install' and any other goals you want in the 'Goals' field
- Click the 'Skip Tests' radio button
- Click Run!
- 确保为您的项目配置了 Maven
- 右键单击您的项目
- 转到“运行方式”
- 选择“运行配置”
- 在左侧栏中,右键单击“Maven Build”并选择“New”
- 选择要从中构建的基本目录(项目)
- 在“目标”字段中写下“安装”和您想要的任何其他目标
- 单击“跳过测试”单选按钮
- 点击运行!
Hope that helps.
希望有帮助。
回答by mishadoff
It depends on maven test plugin that you use. You can try add parameter -Dmaven.test.skip=true
to your build configuration.
这取决于您使用的 maven 测试插件。您可以尝试-Dmaven.test.skip=true
在构建配置中添加参数。
回答by grueny
You can put the property maven.test.skip in a profile in your pom. And then you activate this profile in eclipse in the project properties of maven in eclipse.
您可以将属性 maven.test.skip 放在 pom 的配置文件中。然后你在eclipse中maven的项目属性中在eclipse中激活这个配置文件。
回答by Saeed
accordig to maven's documentyou can write this in you pom.xml:
根据maven 的文档,您可以在 pom.xml 中写入:
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
回答by Zoltán Ujhelyi
At the Run configurations there is a Maven Build type of Run configuration. At that you could set up the standard Maven skipTests parameter.
在运行配置中有一个 Maven 构建类型的运行配置。在那个时候你可以设置标准的 Maven skipTests 参数。