如何在一个maven命令中调用两个不同的配置文件? [英] How do I invoke two different profiles in one maven command?
本文介绍了如何在一个maven命令中调用两个不同的配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在pom.xml
中有两个用于不同环境的配置文件,我必须运行mvn -PTest1 install
和mvn -PTest2 install
命令才能使用这些配置文件.我们可以将两个单独的maven命令集成到一个命令中吗(例如mvn clean install
)?
I have two profiles for different environments in pom.xml
, I have to run mvn -PTest1 install
and mvn -PTest2 install
command to get these profiles in use. Can we integrate two separate maven commands in a single one (like mvn clean install
)?
这是我的Pom条目
<profiles>
<profile>
<id>Test1</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.5</jdk>
<os>
<name>Windows XP</name>
<family>Windows</family>
<arch>x86</arch>
<version>5.1.2600</version>
</os>
<property>
<name>sparrow-type</name>
<value>African</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>
com.endeca
</groupId>
<artifactId>
endeca_navigation_Test1
</artifactId>
<version>
6.1
</version>
<!--<version>stable</version> -->
<scope>
compile
</scope>
</dependency>
</profile>
<profile>
<id>Test2</id>
<activation>
<activeByDefault>false</activeByDefault>
<jdk>1.5</jdk>
<os>
<name>Windows XP</name>
<family>Windows</family>
<arch>x86</arch>
<version>5.1.2600</version>
</os>
<property>
<name>sparrow-type</name>
<value>African</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>
com.endeca
</groupId>
<artifactId>
endeca_navigation_Test2
</artifactId>
<version>
6.1
</version>
<!--<version>stable</version> -->
<scope>
compile
</scope>
</dependency>
</dependencies>
</profile>
</profiles>
使用单个命令管理哈德森工作将很有帮助
It will helpfull to manage hudson job using single command
推荐答案
基于此处,请尝试用逗号分隔配置文件名称:
Based on the documentation and discussion here, try separating profile names with a comma:
mvn install -P Test1,Test2
这篇关于如何在一个maven命令中调用两个不同的配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文