While developing an application, the command I use most often is mvn clean install. Cleaning probably isn't needed 90% of the time, but it does not hurt and might help to avoid weird issues. There are however times, when I'm working on a console application, when I have trunk open on one terminal, and target on another.
mvn clean in such a case does what I need it to - it deletes every file within the target folder - and then fails due to lock on the folder itself. Is there a way to tell it, that in such a case it should just ignore/skip deleting the folder itself and continue with install?
Yes, you can configure the
maven-clean-pluginto ignore errors with the help of thefailOnErrorattribute. It defaults totrue, meaning that the plugin will fail on error.Sample configuration to disable this:
You can also do it directly on the command line, without changing the POM, by setting the
maven.clean.failOnErroruser property:Note that this make the plugin ignore all errors, however it is not currently possible to make it ignore only certain types of errors.