I'm having trouble with something that should easy. When I add a file to my Xcode project using "File->New File..." the file is never placed where I specify.
My project is based on the "J2EE Web Module" template which automatically creates a folder (not a Group) called src containing HelloWorldServlet.java. If I select "New File..." selecting the J2EE->Servlet template and just use the defaults for both "Choose name and location" and "Choose Servlet Properties" Xcode creates the new file not in the src directory as specified in Location, but rather it creates the file within a sub-sub folder of src, the path being .../projectName/src/projectName/servlet/newfile.java
I have tried various different combinations of options (suffix, package, etc.) trying to get Xcode to actually put the file specified by Location with no luck.
First question: what version of Xcode are you using, and what version of the J2EE project templates? If you've upgraded to Xcode 2.0 and Tiger, then take note of this item in the About Xcode Tools release note:
• Java Application Servers Development - The Java Application Servers Development Kit is not included as a custom install option with this release. This optional install includes the XDoclet-based and J2EE project templates, and JBoss. If you are upgrading an existing Xcode Tools configuration which includes these components, they will be left in place. An updated installer for these components will be available as a separate item from the Apple Developer Connection download site,
A follow on question, why can't I move the source file in the file hierarchy within Xcode? I have to go to Finder to fix my file path issues.
In general, Xcode is not the Finder and doesn't do on-disk file management. Dragging files around in the Groups and Files tree is meant to help you conceptually organize files for your project that may not be sensibly organized on disk (especially if you can't change their on-disk organization).
Blue folders in Xcode represent actual File System folders, but only in a read-only fashion; you can't actually reorganize the file system from the Xcode UI. The items in file references are not actually part of the project, but the folder itself can be, for purposes (say) of copying its contents in a Copy Files build phase.
Yellow folders in Xcode represent groups in Xcode's project file, and have nothing to do with on-disk representation (though when you bring a file tree into Xcode, you can have it build a group structure that mimics the on-disk representation).
A finally, when using "Add to Project...", how do you specify the destination group for the "Copy items into destination group's folder..."? Files seem to get added to the top level of the project, I can't select an alternate location, and then I can't move them.
This only works for groups (yellow folders), not folder references (blue folders).
Obviously I'm missing something fundamental. I've read the file organization section in the Xcode documentation but that didn't really shed light on my problem. If anybody can explain where I'm going wrong I would appreciate it.
I just re-read the relevant sections in the Xcode User Guide and it's not very clear on this topic. But in general I think the problem is that you're using folder references in places where you should be using groups, and expecting Xcode to perform file-system manipulation like the Finder, which it doesn't.