views:

293

answers:

5

I would like to commit new .class files into CVS via Eclipse, but these files get ignored, and I'm not sure where to turn that off. The Preferences windows a section for doing this, but .class isn't listed.

A: 

May I ask why you want to commit .class files into a repository? Usually only source files and static libraries are commited to a repository. This is because every change in source code results in a change of the class file which then would also need to be recommited.

Best wishes,
Fabain

halfdan
I hear you. It's a long story, but needless to say we need to commit class files to CVS for the time being.
Daniel Bigham
This should be a comment. As much as I agree that checking in .class files is a Bad Thing, it doesn't answer the question.
Rob Hruska
A: 

Are you really sure you want to be checking compiled files into CVS? I've never worked on a project that does this - it is a bad practice.

You should only really store source code in CVS, not the files generated from the source code. There is no true need to check these in because they can be re-generated from source code at any point in time.

By checking in the output of your source code, you're only going to introduce the possibility of headaches due to someone forgetting to check a .class file in, etc.

matt b
This should be a comment. As much as I agree that checking in .class files is a Bad Thing, it doesn't answer the question.
Rob Hruska
Well if you can convince someone to abandon A Bad Practice (TM), isn't that an answer in and of itself? http://weblogs.asp.net/alex_papadimoulis/archive/2005/05/25/408925.aspx
matt b
+2  A: 

Preferences > Team > Ignored Resources

Also, change to the Resources Perspective to see all files.

rodrigoap
+1  A: 

First of all I'd like to echo the sentiment of the other answers, in that checking the compiled source files into source control is a very bad idea, as it means any time someone makes a change to the source, they'll have to remember to checkin the corresponding class file.

Regarding your specific question, this page states that all generated .class files are automatically marked as derived, meaning they won't be checked in automatically:

Any resource marked as derived will be automatically ignored for version management by Team CVS. Some builders, such as the Java builder, mark all of its build output (e.g. .class files) as derived.

To my knowledge there no way of changing this, which should underline that this is a bad idea.

Jared Russell
+1  A: 

I ended up figuring it out... it's a little odd: You have to go into the Preferences window (Team -> Ignored Resources) and add ".class" as an ignored resource, then uncheck the check box.

Daniel Bigham