We had a maven project connected to svn repository. There were some folders or file types that we never want to commit such as target folder, bin folder or .class extension files. We had ignored target folder in Eclipse settings as described below but still it was showing target folder and its content while going to commit code from Eclipse.
Add Pattern to the ignore list:
Go to Window menu-> Preferences -> Team -> Ignored Resources.
You will see the below Dialog box:
We had applied those changes but still when we opened svn commit dialog box, target folder was still showing. As target folder contained large number of files, we had to traverse a long list of files to uncheck so that we could commit only required files.
Solution: Subversion’s support for ignorable file patterns extends only to the one-time process of adding unversioned files and directories to version control. Once an object is under Subversion’s control, the ignore pattern mechanisms no longer apply to it. In other words, don’t expect Subversion to avoid committing changes you’ve made to a versioned file simply because that file’s name matches an ignore pattern—Subversion always notices all of its versioned objects.
Note: install svn command line plugin
Run Command: pre>sudo apt-get install subversion
To check whether target folder is under version control or not
Go to project location in your workspace
Run svn status command:
As it is showing target folder in the output, it means that target folder is already under version control hence it will never affect with your ignore file list. Svn will commit every file that is under version control.
To avoid committing such folders that are already under version control, do following:
1. Delete the existing directory as below:
Subversion’s support for ignorable file patterns extends only to the one-time process of adding unversioned files and directories to version control
2. Run below command to add the folder to ignore list:
svn propset svn:ignore target
.(dot) – stands for current directory.
target folder is the directory name to ignore.
3. Now run svn status again and you will see target folder is missing from the list:
4. Also you can check in Eclipse now:
Note: Now in case if you want to commit some ignored folders again:
Run command: svn propdel svn:ignore
It will take ignored files/folders list under version control again.