I have a project with 2 profiles, because UAT and PROD use different versions of the same jar.
I have noticed that if i don't explicitly call mvn clean ...
the deployed EAR will have BOTH UAT and PROD jars.
Is there a way in the POM to specify that Maven should always clean before any building?
Use the maven-clean-plugin
with the initialize
phase as given here
http://maven.apache.org/plugins/maven-clean-plugin/usage.html
<project>
[...]
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<id>auto-clean</id>
<phase>initialize</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
[...]
</project>