【发布时间】:2018-09-15 12:55:57
【问题描述】:
我有一个带有 TestNG 的 Java maven 项目
请看这个pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<fork>true</fork>
<executable>C:\Program Files\Java\jdk1.8.0_181\bin\javac.exe</executable>
</configuration>
</plugin>
所以在Windows 中,当我想从命令行运行这个项目时,我只需导航到这个pom.xml 文件夹,然后:
mvn clean test
这将开始我的所有测试。
现在在这个pom.xml 中,我有我的javac.exe 路径,所以为了在MAC 中运行这个项目,我需要添加/更改什么? (我希望它支持两种操作系统)
【问题讨论】:
-
可以使用maven profiles,根据环境触发相应的。
-
我可以举个简单的例子吗?