How can I make Eclipse file search not include svn directories? - eclipse

When I do a file search on eclipse it includes the .svn directories by default. I tried excluding them from the build path but they still appear on file search results.

Spaceman is right. With Helios, choose Project -> Properties -> Resource -> Resource Filters and then add an exclude filter for type "Folder" with name .svn.

If you install the subclipse plugin then it automatically excludes the .svn directories (plus provides some other cool stuff in the IDE).
http://subclipse.tigris.org/
If it does not work, simply restart Eclipse (sometimes it's needed on a fresh checkout)

Following up on Mark Ingram's excellent answer, simply installing the plugin won't get you there -- You'll still need to Share your project in order for the automatic Search filtering to take hold. After you set up the SVN repository location from within the Subeclipse view you may Share your project by doing the following:
From within Package Explorer, right-click the project name
Select the Team context menu option and then Share Project....
Step trough the wizard to tie your project to its location in the svn repository
Once you complete that and the workspace rebuilds you are all set to enjoy filtered search.

Excluding the .svn folders by making them derived stops then appearing in the search results, see here.
You have to do it manually for each folder, if you have a lot of .svn folders then it's not ideal.

If you are gonig down the plugin route, I tend to prefer subversive over subclipse.

Ah - OK. I don't use SubVersion per se, but would this be of any use? It claims it can do what you want...

Eclipse import would also contain file of type .java.svn-base, so its better to give as in below image
[[1]: https://i.stack.imgur.com/szDxP.png][1]

You can off course also select ALL the file name patterns to include in the file search dialog

Click on the drop-down triangle in the top-right corner of the Navigator and choose "Filters..".
By default Eclipse only offers you ".class" and ".".
If you choose ".*" you'll hide .svn files. Obviously all other .something files will also be hidden.

Related

How do I show an arbitrary folder in the Eclipse Package Explorer?

There are a couple of folders in different locations on my hard drive that contain resources I use a lot while coding (documentation, links, ...) but aren't really related to any specific one of my projects.
How can I have the Eclipse Package Explorer show such a folder that is not inside one of my existing projects?
One potential use: Quick way to transfer "External Tool Configurations" from one Eclipse install to another?  (see comments to accepted answer...)
Since everything that the Package Explorer shows has to be in a project (as pointed out by #greg-449), one needs to create a dummy-project in the required location:
Go to: File ⇒ New ⇒ Project... ⇒ General ⇒ Project
Pick a Project name
Uncheck Use default location
Browse... for the folder to show
Click Finish
Minor cosmetic issue: Eclipse will save a .project file in that folder...
Aside:
To make this folder appear at the top of the list, one can give it a name like _Documentation_ as Eclipse sorts the underscore before any letters.

Subclipse: How to add the default output folder to version control (*.class files)?

I am using eclipse 4.2 and Subclipse 1.8.20.
I am trying to add the contents of /WebContent/WEB-INF/classes to version control (this is also the default output folder of my project).
First let me state that this is possible with TortoiseSVN. I do understand why by default Subclipse ignores this directory, and I tried to change the Team settings, but I am not seeing a relevant entry for *.class files:
Is this at all possible with Subclipse?
More info:
Old an unanswered similar question: http://subclipse.tigris.org/ds/viewMessage.do?dsForumId=1047&dsMessageId=473163
Same topic but opposite question: How can I ignore build directory in Subclipse?
It is a horribly bad idea to version your build directory. Every time Eclipse does an auto-build it will cause all of the files to need to be committed again.
To answer your question, all Eclipse team providers automatically ignore any resource that is marked as "Derived" by Eclipse. The Derived flag is set on files that are created by the Eclipse builders. If you select one of these files that are ignored in Eclipse, right click and choose Properties. Navigate to the Eclipse Resource page. There will be a bunch of checkboxes. You should see that one of these is labelled Derived and will likely be checked.
Do not try to change the checkbox value. I am just pointing out where you can see and confirm this.

Eclipse file search finds the same file multiple times

In Eclipse I have two maven projects A and B, where A is a parent for B. The directory structure is the following:
A/pom.xml
A/B/pom.xml
A/B/...
Then I use File search (Ctrl+H) to find any file in the project B. The search result window shows the file two times with different relative paths:
A/B/<my_file>
B/<my_file>
So, the same file is shown twice. Obviously, the first search result is reduntant. Is there a way to exclude these duplicate search results?
What I personally do to avoid this is marking each module in the parent project as derived (right-click on the folder > properties > Attributes: Derived).
Then when you perform a file search, uncheck "Consider derived resources" (I don't think it is checked by default) and you won't get the A/B/<my_file>.
The only inconvenience is that you must do this for each module, and each time a new module is added.
In an open resource window (cntrl+shift+R), click on the arrow on top-right and check "Filter Duplicated Resources". This worked for me.
Checking Window -> Preferences -> Maven -> Hide folders of physically nested modules (experimental) worked for me in Mars.1 Release (4.5.1).
After checking it I closed all projects within eclipse, deleted eclipse project files (.project, .classpath and .settings) and reimported my maven projects.
I had similar problem.
My solution for this problem was
Create eclipse "working set" of projects to search
Set this working set as option into search dialog
Search in it
Windows - Preferences - Maven - Hide folders of physically nested modules
I agree with Damon Horrell.
Go to Windows - Preferences - Maven - Hide folders of physically nested modules (make sure the checkbox is checked).
Note: Make sure to re-import the maven project into eclipse to see the changes.
Within the parent project, child ones were already visually hidden in my case, but still found through search and Ctrl-click links.
I solved this by using Resource filters:
Right-click (parent) project > Properties > Resource > Resource Filters
Click Add Filter..., select Applies to -> Folders and enter one child project's folder name, click OK
Repeat 2. for all child project folders
By the end, you should have something like this:
There is an ancient bug which requests Eclipse to support nested projects. Opened 2008, won't happen soon, I guess.
Since Eclipse doesn't support Maven's default nested module layout, you have to import each module individually which doesn't confuse Eclipse but it can confuse you as you can see in the search results. Similar things happen when you start to save launch configs in a module.
There are several possible solutions:
Get used to ignoring half the search results. Takes some discipline but no magic.
Make sure your root project doesn't contain anything important that you might want to open from Eclipse (i.e. move the parent POM to a new module which must be a child of the root project). Now you can close the root project.
Takes some discipline where to put things in your project and it's clumsy when you have to add new modules.
Use the flat multi-module approach. This is an extension to #2, it looks odd and there might be plugins that are offended by that. So if you use a lot of nonstandard plugins, you should check whether they like the new layout.
As a new joiner, still couldn't comment but I'd really like to add something to the best answer. It works! It not only removed the duplicate files for me (one from child module and one from parent module), it also removed the class files from parent module).
But it added the folder to my .gitignore which will cause problem for new files/directories added later. I just reverted the change to .gitignore and it still works in eclipse.
Find this answer to disable auto change of .gitignore
EGit and Eclipse modifies .gitignore file but it should not
You can solve this problem using a flat multi-module approach.
Caveats may apply if you're using the maven-release-plugin with a version control system other than Subversion.
In addition to "Hide folders of physically nested modules" mentioned, you could uncheck parent modules when importing Maven project:

exclude files from jar or war in eclipse

Is there a way to tell Eclipse to not include specified files, directories, or patterns in a JAR or WAR?
You can specify includes and excludes by opening the Project Properties (alt-enter) then opening Java Build Path and the Source tab. Against each source location there is a little plus sign, click on that then select Included or Excluded then select the Edit... button.
source path screenshot http://help.eclipse.org/ganymede/topic/org.eclipse.jdt.doc.user/gettingStarted/images/qs-WorkingWithExistingLayout26.png
You can then specify multiple patterns for files to be included/excluded. These files will not be processed to the output directory. The patterns follow Ant's wildcard patterns so you have quite fine-grained control over what to include.
(source: eclipse.org)
We fought with this problem too and didn't find a good standard solution for it in Eclipse WTP.
Hence we added Project Archives to JBoss Tools (http://jboss.org/tools) which allow you to control explicitly via "ant filter sets" what goes in and what goes out of your archive.
This archive you can then deploy with the standard WTP mechanism for deployment on the server types supplied by JBoss tools.
We are working on adding similar support back into native Eclipse WTP, but that won't be available until sometime next year.
to add to what #Rich_Seller said: in Eclipse Indigo:
Select your package from the package view right click, and choose Export.
Choose Java -> JAR file from the "select an export destination" tree.
Click Next to go to the next page of the wizard.
Under the "Select the resource to export" you are presented with a
tree view here you can select and deselect components that will be
included and excluded from the JAR.
I think including an XML file in another and then removing its visibility in the war file should give you an on off switch.

Eclipse - Ignore Entire Directories

I use Aptana Studio (based on Eclipse). I'm trying to get Eclipse to completely ignore an entire directory inside a project. I mean COMPLETELY. I don't want it to display in the project folder. I don't want Eclipse to even be aware it exists.
Unfortunately, all my efforts to add it as a filter don't work. See http://forums.aptana.com/viewtopic.php?f=14&t=8340#p33714 . I think the filter only prevents the folder from being displayed in the project display. It doesn't keep Eclipse from actually looking at all the files in that folder for code assist, etc.
My problem is that directory has thousands of text files. So, each time Eclipse opens or refreshes this project, it analyzes all those files.
How can I prevent this?
Not sure about this aptana thing, but there is a convenient way to do it in native eclipse:
Right-click a project folder in Project Explorer tree and go to "Properties".
Resource -> Resource Filters.
Add as much exclusion filters for files/folders as you like.
If your project tree is not refreshed immediately, press F5 to enforce it.
Consider also the 'Derived' checkbox: right-click an entry in the package explorer, choose properties, check Derived. This may solve part of your problem.
See http://robmayhew.com/eclipse-ignore-folder/
If you have a linked resource (pointing off to some other file/folder on disk) with the same name in the same location in the resource tree, then the real folder on disk will be hidden from the resource model.
Unfortunately you can't create the linked resource if the real directory is already there in the project structure. You can try something like this:
On disk, rename/move the directory in question
Refresh the project, the directory is gone
Create a linked resource ( New -> File/Folder >> Advanced -> Link to file in the file system ). Name it the same as the original directory.
On disk, restore the original name of the directory
Refresh project.
Try right-clicking "Properties" and unchecking all permissions.