How to handle generated code I need to check into source control Follow
There's a directory in my project that's all generated code. I never want to search in there, and I don't need to look at the code, so in the past I just never created a module for it, making it effectively not exist in IDEA. But recently I've started using IDEA's SVN support, so I need to see that directory to check in the generated files.
How do people handle this situation? I doubt there's a way to mark a directory as never-search-in-here. Similarly, I don't see any way to show a directory only in SVN Changes view.
Any thoughts or experiences?
Please sign in to leave a comment.
If it is a Maven project, you could put the generated files under target/generated-sources. Idea doesn't search in target-folders.
Hmmm, not Maven in my case, just Ant.
Is there a way to tell IDEA not to ever search a particular project directory? The Maven-target thing is built-in, not configurable?
You can go to Project Structure, and _exclude_ directory for corresponding module it's under
It wouldn't be searched than, and not visible for VCS
Thanks for your reply, but the generated code HAS to be visible to VCS, so I can check it in. That also means it needs to be visible in the project panel, so I can navigate to it to promote it. I just want it excluded from searches, both because I don't care about results in there, and so I don't mistake a search result in there for code I should modify.
So I guess what I'm looking for is a way to "permanently" exclude directories from searches, while leaving them visible in the project panel and to VCS.
You could define a Scope.
For this you can say all files but not what is in that directory.
Then you can choose that scope when doing searches.
Thanks Björn, I was completely unaware of scopes, and so far, that seems to work quite well.
I had previously tried defining a favorites list that was the search scope I typically wanted, and conceptually that works, but for some reason search performance was awful. This isn't that big a project, and searching that favorites list took tens of seconds! Searching an identically defined scope is pretty much instantaneous, like I'm used to in IDEA.
Guess I should learn more about scopes and how they can be used. Besides searching, how do you (and whoever else is listening) use them?
It's funny, I've been using IDEA pretty much every day for about a year and a half, and there are still useful features I've just never had the occasion to get familiar with, at least that I knew. Great product!
I don't really use custom scopes, maybe for a search from now to then.
Mainly I use the predefined "Project Files" and "Project and Library Files" scopes for searches, usage searches and so on, if I also want to find calls in libraries e. g.
Do you know what their main purpose is? How thy're mainly intended ot be used?
Thaks, that's what I saw when I checked them out briefly after your mention. It does seem like a useful concept, though a little bit of yet-another-way syndrome.
Yet another way of doing what?
Similar but not the same as favorites, modules, project directories, all the various ways you can partition and "tag" code areas.
Sure, but the use-case is different.
Favorites are only shortcuts to other places.
Modules are for grouping which files belong to a component of your project.
Project Directories are for logically grouping your files in an IDE independent manner.
Scopes are for creating more fine-grained (or also more coarse grained, e. g. creating a scope that contains all XML files from all modules) groups of files you want to run a task like Insepctions, Usage searches, ..... on.