Maven 如何使此插件仅在非Windows平台上运行?
我使用的是Maven 3.0.3。对于我们的项目集成测试,我们需要使用Unix命令创建虚拟帧缓冲区。然而,当我们在Windows机器上运行我们的项目时,我们不需要这个。我们使用Maven 如何使此插件仅在非Windows平台上运行?,maven,Maven,我使用的是Maven 3.0.3。对于我们的项目集成测试,我们需要使用Unix命令创建虚拟帧缓冲区。然而,当我们在Windows机器上运行我们的项目时,我们不需要这个。我们使用 <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution>
<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>
maven antrun插件
启动xvfb
过程测试资源
跑
关闭xvfb
整合后测试
跑
当平台不是windows时,我如何运行上面的程序,否则如何抑制插件的运行?谢谢,-Dave你可以用个人资料来做这件事。操作系统设置有配置文件激活开关。这个插件非常智能,你可以使用否定
<profiles>
<profile>
<activation>
<os>
<family>!windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
...
</plugin>
</plugins>
</build>
...
</profile>
</profiles>
,以及您可以使用的值。您能为OS系列提供一个逗号分隔的值吗?我希望它只在linux上执行