Chính sách của chúng tôi là chỉ xây dựng 1 chiếc bình có thể triển khai. tất cả các cấu hình theo môi trường cụ thể được giữ riêng biệt và chúng tôi cùng nhau tạo tất cả cùng một lúc. vì vậy theo quy trình Ant hiện tại của chúng tôi, chúng tôi có một tệp thuộc tính cho mỗi môi trường, lặp lại chúng và tạo một tập hợp các tệp cấu hình cho từng môi trường.Maven Xây dựng nhiều cấu hình trong một lần
Trong POM XML hiện tại của tôi, tôi chỉ có thể xây dựng một cấu hình được cung cấp tại dòng lệnh. Có thể đạt được thông qua Maven không?
Dưới đây là một số các phần có liên quan của pom.xml
<!-- Define profiles here and make DEV as default profile -->
<profiles>
<!-- dev Profile -->
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<!-- qa Profile -->
<profile>
<id>qa</id>
<properties>
<env>qa</env>
</properties>
</profile>
<!-- prod Profile -->
<profile>
<id>prod</id>
<properties>
<env>prod</env>
</properties>
</profile>
</profiles>
...
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<filters>
<filter>env/${env}.properties</filter>
</filters>
<outputDirectory>${project.build.directory}/config/${env}
</outputDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/config/default
</directory>
<includes>
<include>*.xml</include>
<include>*.properties</include>
</includes>
</resource>
.....
Cảm ơn, Prabhjot
Đây là mô tả cách giải quyết cho việc này: https://stackoverflow.com/questions/12320322/build-multiple-artifacts-with-different-classifiers-at-once – stokito