당신은 당신이 당신의 pom.xml
의 프로파일을 정의 할 필요가 maven profiles 및
resource plugin를 사용하여이 작업을 수행 할 수 있습니다
</profiles>
<profile>
<id>variantA</id>
<build>
<!-- custom conf for variant A -->
</build>
</profile>
</profile>
<profile>
<id>variantB</id>
<build>
<!-- custom conf for variant B -->
</build>
</profile>
</profiles>
그런 다음 원하는 프로파일로 빌드 invoque : 또한
mvn clean install -P variantB
Resource 플러그인을 사용하면 전체 color.xml 파일을 덮어 쓸 수 있습니다 (이 예제에서는을 만듭니다).3210 파일 src/templates/resVariantA
) :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/res</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${project.basedir}/src/templates/resVariantA</directory>
<targetPath>${project.basedir}/res</targetPath>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
희망이 있습니다.