We are using Maven to compile our project on a build server. We update our sources from SVN and then run "mvn install" from the project folder, building a jar we then deploy to our production servers.
To save time on compilation, we keep the compiled classes before we recompile (in the target/classes folder maven creates). This way, Maven only needs to recompile new or changes java files.
But there is a problem with moved/deleted files: the SVN update removes the .java files from the sources path, but Maven doesn't remove the compiled .class files from target/classes. Same goes for files which are deleted from the main/recourses folder. So, the deleted/moved classes and deleted resources still end up in the jar file we deploy to our production servers, and this causes problems.
I know we can "mvn clean" to get rid of any compiled files, but this way we need to recompile the whole project on every build, which costs a lot of time.
Does anyone know a way to remove obsolete .class files and resources before or during Maven compilation?