我希望我的pom.xml根据操作系统行事。这个pom服务于我对linux64和windows 64的目的。但是如何为Windows 32(服务器和客户端)触发两个不同的命令
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<groupId>xyz</groupId>
<artifactId>xyz</artifactId>
<version>1.0-SNAPSHOT</version>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<name>xyz</name>
<url>http://maven.apache.org</url>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>xyz</groupId>
<artifactId>xyz</artifactId>
<executions>
<execution>
<id>xyz</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<compileConfig>
<param>
<os>windows</os>
<environment>
<property>
<name>WINARCH</name>
<value>${xyz.platform}</value>
</property>
</environment>
<commands>
<param>
<command>devenv /Rebuild "Release|x64"
%WORKSPACE%/main/dev/server/server.sln || exit /b</command>
<directory>build</directory>
<quiet>true</quiet>
</param>
</commands>
</param>
<param>
<os>nix</os>
<environment>
<property>
<name>UNIXARCH</name>
<value>${xyz.platform}${xyz.nix_build_config}</value>
</property>
</environment>
<commands>
<param>
<directory>build</directory>
</param>
<param>
<command>make clean;make_nowarn</command>
<directory>build</directory>
</param>
<param>
<command>./failIfWarning.sh</command>
<directory>build</directory>
</param>
</commands>
</param>
</compileConfig>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
</plugins>
</build>
答案 0 :(得分:1)
带有轮廓的尖端是正确的方向:
<profiles>
<profile>
<id>windows</id>
<activation>
<os>
<family>Windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>..</groupId>
<artifactId>..</artifactId>
<configuration>
Windows part
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>linux</id>
<activation>
<os>
<family>Unix</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>..</groupId>
<artifactId>..</artifactId>
<configuration>
Linux part
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>