如何使此插件仅在非Windows平台上运行? [英] How do I make this plugin run only on non-Windows platforms?
问题描述
我正在使用Maven 3.0.3.对于我们的项目集成测试,我们需要使用Unix命令创建一个虚拟帧缓冲区.但是,当我们在Windows计算机上运行项目时,则不需要此功能.我们使用
I'm using Maven 3.0.3. For our project integration testing, we require a virtual frame buffer to be created, using Unix commands. However, when we run our project on the Windows machines, we don't need this. We use
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>start-xvfb</id>
<phase>process-test-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="Starting xvfb ..." />
<exec executable="Xvfb" spawn="true">
<arg value=":0.0" />
</exec>
</tasks>
</configuration>
</execution>
<execution>
<id>shutdown-xvfb</id>
<phase>post-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="Ending xvfb ..." />
<exec executable="killall">
<arg value="Xvfb" />
</exec>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
在平台不是Windows的情况下如何运行上述程序,否则如何禁止插件运行?谢谢,-戴夫
How can I make the above run when the platform isn't windows and suppress the running of the plugin otherwise? Thanks, - Dave
推荐答案
您可以使用配置文件执行此操作.有用于OS设置的配置文件激活开关.而且该插件非常智能,您可以使用取反.
You can do this with profiles. There is profile activation switch for OS settings. And the plugin is so intelligent, you can use negation.
<profiles>
<profile>
<activation>
<os>
<family>!windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
...
</plugin>
</plugins>
</build>
...
</profile>
</profiles>
有关个人资料的更多信息,可以在此处找到,以及关于您可以在此处使用的值.
Further information about profiles can be found here, and about the values you can use here.
这篇关于如何使此插件仅在非Windows平台上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!