Reputation: 3144
I have been using maven for some time and I am quite fond of it. But there are some minor annoyances that must be fixed I think.
There is this clean phase, I need to use it from time to time because there may be some old classes on the packaging file which brings chaotic errors on application server.
I know that when i execute the package phase, it runs all the other phases before it but not clean. Because clean is in clean lifecycle.
So is there any way to add clean to default lifecycle?
Thanks
Upvotes: 3
Views: 430
Reputation: 7989
I would not add clean to default lifecycle just to clean old compiled classes - it will break conventions of maven users.
It is much easier to type mvn install
or mvn clean install
when required than trying to figure out why it always recompiles all from scratch and trying to skip that auto-cleanup.
Upvotes: 2
Reputation: 3170
probably this can work
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>auto-clean1</id>
<phase>initialize</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
<execution>
<id>auto-clean2</id>
<phase>package</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
Upvotes: 3