
Subversion and the importance of svn:ignore for MAVEN multi modules

Maven 2 builds can be quite slow, especially if you are not following the best practices of using Maven in Eclipse. For example if you are not removing all /target directories from version control!
If you let /target directories going into version control, the following happen:
- Each full build of the workspace,
- Each partial build of modules,
Will clean /target directories, and thus force the SVN daemon to mark files as changed… thus consuming an enormous amount of time and resources (disk IO). You may also have obstructed files, because some developer may have committed some of these target files, but the build may wipe the /target/.svn metadata
Obstructed files
In a status operation denotes that the item in the Working Copy being currently processed has a non-expected kind. For example, a file is considered to be obstructed if it was deleted (with an SVN client non-compatible delete operation) and a directory with the same name as the file had had was added (but again with an SVN client non-compatible operation). Typically what Maven is doing in goals clean and compile
The solution
Typically it is recommended to hide Eclipse project artifacts and Maven build targets from Subversion/CVS. M2Eclipse like to change the .classpath file (sometimes some entries are 3 times available in this file BUG?), this is one more reason not to commit these files.
If you use CVS
First Check in your project using the Eclipse team support (select from the context menu Team > Share Project), but only check what is needed. You should have a .cvsignore file, prior to commit, with the following entries for each module:
.project
.classpath
.settings
.wtpmodules
target
If you use SVN, you can set the svn:ignore property on all shared module and project by
- First Check in your project using the Eclipse team support (select from the context menu Team > Share Project), but only check what is needed.
- Then select all Maven projects and Maven modules,
- Right clicking on them while selected,
- Select Team – Set Property
- Enter at least the following entries.project
.classpath
.settings
.wtpmodules
target
You will see that the specified files and directories are now being ignored by Subversion.
Note
- Eclipse will automatically generate a new simple .project-file/ .classpath-file when you check out the project from the repository.
- I would like to see M2Eclipse being able to automatically remove the target directory from SVN/CVS while sharing…