To achieve this I have used the "packagingExcludes" property of Maven war plugin. For more info and examples of using this property see this page. To exclude files by Maven profile you need to first parameterize the value of "packagingExcludes" in war plugin declaration in pom file
In Maven profile you can define the value of this property by profile
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<packagingExcludes>${pkg.exclude}</packagingExcludes>
</configuration>
</plugin>
In Maven profile you can define the value of this property by profile
<profile>
<id>prod</id>
<properties>
<pkg.exclude>WEB-INF/classes/com/internal/*.class,internal/*</pkg.exclude>
</properties>
<activation>
<property>
<name>environment</name>
<value>prod</value>
</property>
</activation>
</profile>
No comments:
Post a Comment