如何配置maven安装以跳过eclipse中的测试?
是否可以在 Eclipse 中配置 run as maven install 来跳过单元测试?如果可以的话,该怎么办呢?
Is it possible to configure run as maven install in eclipse to skip unit tests? If so, how can it be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
根据 maven 文档 你可以这样写你的pom.xml:
accordig to maven's document you can write this in you pom.xml:
这取决于您使用的 Maven 测试插件。您可以尝试将参数
-Dmaven.test.skip=true
添加到构建配置中。It depends on maven test plugin that you use. You can try add parameter
-Dmaven.test.skip=true
to your build configuration.您可以将 maven.test.skip 属性放入 pom 的配置文件中。然后你在eclipse中maven的项目属性中激活这个配置文件。
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 构建类型的运行配置。此时,您可以设置标准 Maven skipTests 参数。
At the Run configurations there is a Maven Build type of Run configuration. At that you could set up the standard Maven skipTests parameter.
将其放入我的 Pom.xml 中会关闭我的测试 - 但在 Maven 构建时,而不是在 Maven 安装时。
Putting this in my Pom.xml turned off the tests for me - but at maven build, not at maven install.
您的构建类型并添加参数 -DskipTests=true
-Dmaven.test.failure.ignore=true
跳过测试的 Maven 构建目标的示例是: clean install -DskipTests=true -Dmaven.test.failure.ignore=true。
your kind of build and add the parameters -DskipTests=true
-Dmaven.test.failure.ignore=true
An example of a maven build goal to skip tests is: clean install -DskipTests=true -Dmaven.test.failure.ignore=true.