2011-01-22 11 views
8

Nasza aplikacja składa się z różnych aktywnych profili (np. A1, A2, A3, A5 ...), które zostały osobno zdefiniowane w pliku profiles.xml. Maven 3 oczekuje, że wszystkie informacje o profilu będą przechowywane jako część samego pliku pom.xml.Jak określić aktywne profile w Maven3

Jak należy określić listę aktywnych profili w pliku pom.xml, tak, że można uniknąć podając je w wierszu poleceń (np mvn -PA1, A2, A3, A5)

Odpowiedz

8

Powinny to zrobić to:

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

Od here.

+0

Nie mogę określić tego dla wielu profili, nie sądzę, że sugestia działa – user339108

4

Dodatek do odpowiedzi @ javamonkey79 można użyć pliku settings.xml. Istnieją części profili i aktywacji. Spójrz na następujący przykład:

<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>