2011-01-22 42 views
8

我們的應用程序由各種在profiles.xml文件中分別定義的活動配置文件(比如A1,A2,A3,A5 ...)組成。 Maven 3預計所有的配置文件信息都將作爲pom.xml文件本身的一部分進行存儲。如何在Maven3中指定活動配置文件

我應如何pom.xml文件中指定的活動配置文件清單,以便我能避免在命令行中指定它們(如MVN -PA1,A2,A3,A5)

回答

8

應該做這它:

<profiles> 
    <profile> 
    <id>profile-1</id> 
    <activation> 
     <activeByDefault>true</activeByDefault> 
    </activation> 
    ... 
    </profile> 
</profiles> 

here

+0

我無法指定此爲多個配置文件,我不認爲該建議的作品 – user339108 2011-08-15 13:21:23

4

@javamonkey79的答案可以使用settings.xml。有一些配置文件和激活。看看下面的例子:

<profiles> 
    <profile> 
    <id>hudson-simulate</id> 
    <properties> 
    <gituser>username</gituser> 
    <gitpassword>secret</gitpassword> 
    </properties> 
    </profile> 
    <profile> 
    <id>other-profile</id> 
    <properties> 
    <proerty1>username</property1> 
    </properties> 
    </profile> 
</profiles> 

<activeProfiles> 
    <activeProfile>hudson-simulate</activeProfile> 
    <activeProfile>other-profile</activeProfile> 
</activeProfiles> 
相關問題