简体   繁体   English

maven-surefire-plugin系统属性和eclipse集成?

[英]maven-surefire-plugin system properties and eclipse integration?

I set system properties for the surefire execution in maven's pom.xml. 我在maven的pom.xml中为surefire执行设置了系统属性。 Eclipse ignores those. Eclipse忽略了这些。 Is there any way to fix that issue? 有什么办法可以解决该问题?

In particular I use the basedir property to determine file locations, ie the build directory etc. 特别是,我使用basedirir属性来确定文件位置,即生成目录等。

I don't want to run the tests as "maven test" because that's slow. 我不想将测试作为“ Maven测试”运行,因为那很慢。

Update 更新资料

I'm now using the test class' resource location to determine the project location on disk: 我现在使用测试类的资源位置来确定磁盘上的项目位置:

https://github.com/jjYBdx4IL/misc/blob/master/env-utils/src/main/java/com/github/jjYBdx4IL/utils/env/Maven.java#L64 https://github.com/jjYBdx4IL/misc/blob/master/env-utils/src/main/java/com/github/jjYBdx4IL/utils/env/Maven.java#L64

This requires no configuration at all . 这就要求在所有的任何配置。

<dependency>
    <groupId>com.github.jjYBdx4IL.utils</groupId>
    <artifactId>env-utils</artifactId>
    <version>1.0</version>
</dependency>

I'm assuming from what you're saying, when you run maven at the command line, you've got environment variables set, which maven picks up. 我是根据您的意思假设的,当您在命令行中运行maven时,您已经设置了环境变量,而maven会选择该环境变量。 If this is the case, then either passing it along on the command line or setting the system properties seem like it might be the solution that you're looking for. 如果是这种情况,那么要么在命令行中传递它要么 设置系统属性似乎是您正在寻找的解决方案。 The other thing is, make sure you're using "project.basedir", not just "basedir". 另一件事是,确保您使用的是“ project.basedir”,而不仅仅是“ basedir”。 See here for the property names 请参阅此处以获取属性名称

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM