How to do a Maven Clean on project import?
Is there a way I can add the Maven lifecycle CLEAN to IntelliJ during "Add Maven Projects" or "Reimport All Maven Projects"?
What I am noticing is Maven projects that I reimport into my workspace often has stale code in the target directory. The code that gets deployed to my Tomcat directory would be out of sync with the source. What I have to do to resolve this issue is execute the Maven lifecycle CLEAN to blow away the target directory to fix this.
Please sign in to leave a comment.
There is no setting for doing such. You could open a feature request to ask to have something like that added.
As a workaround, if you do your imports manually (rather than via the auto-import setting), you could write a simple macro that does the import and then a maven clean. Map that macro to a keyboard shortcut and use that instead of the maven import.