2011-01-22 11 views
8

Ứng dụng của chúng tôi bao gồm các cấu hình hoạt động khác nhau (nói A1, A2, A3, A5 ...) được xác định riêng trong tệp profiles.xml. Maven 3 hy vọng tất cả thông tin hồ sơ sẽ được lưu trữ như là một phần của tệp pom.xml.Cách chỉ định các cấu hình hoạt động trong Maven3

Làm thế nào tôi nên xác định danh sách các hồ sơ hoạt động bên trong một file pom.xml, vì vậy mà tôi có thể tránh được chỉ định chúng trong dòng lệnh (ví dụ mvn -PA1, A2, A3, A5)

Trả lời

8

nên làm này nó:

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

Từ here.

+0

Tôi không thể chỉ định điều này cho nhiều cấu hình, tôi không nghĩ rằng đề xuất hoạt động – user339108

4

Bổ sung vào câu trả lời của @ javamonkey79, bạn có thể sử dụng tệp settings.xml. Có một số cấu hình và kích hoạt. Hãy xem ví dụ sau:

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