WebObjects 5.2.x: How to Rename a Project with Xcode in Mac OS X 10.3 or later

When renaming a WebObjects or Cocoa project using the Rename command from the Project menu in Xcode, the resulting executable file may retain the original name of the project. This is because, with Xcode in Mac OS X 10.3 or later, the name must be changed in other places in addition to choosing Rename from the Project or File menu.

Assume you are starting with a project named "MyWOProject" and that you want to change its name to "MyNewWOProject".

Note that projects originally created with ProjectBuilder will include a project file with the suffix .pbproj. Xcode will not change that suffix to .xcode. Projects originally created with Xcode will include a project file with the .xcode suffix.

Steps for renaming a project

  1. Duplicate the "MyWOProject" directory and name it "MyNewWOProject".
  2. Rename the MyWOProject.pbproj file inside the MyNewWOProject directory to MyNewWOProject.pbproj. In the case of a project originally created with Xcode, change the name from MyWOProject.xcode to MyNewWOProject.xcode.
  3. Open the MyNewWOProject project in Xcode.
  4. Rename the MyWOProject target MyNewWOProject.

    1. Click on the disclosure triangle to the left of the Targets Group in Xcode's Groups & Files pane. This reveals the aggregate target named MyWOProject, and the Application Server and Web Server targets.
    2. Click on the aggregate target named MyWOProject in the Groups & Files pane.
    3. Choose Project > Rename. In some versions of Xcode, Rename appears under the File menu.
    4. Replace MyWOProject with MyNewWOProject.

  5. Choose Clean All Targets from the Build menu. At this point, if you build the project, the executable still has the name MyWOProject, as does the .woa directory and the URL for connecting to the application. A few more steps are necessary to complete the process.
  6. Close the MyNewWOProject project in Xcode or quit Xcode, so that Xcode will not attempt to prevent changes to the project files.
  7. Open the MyNewWOProject/MyNewWOProject.pbproj/project.pbxproj file with a text editor. (If the project was originally created with Xcode, it will be located in MyNewWOProject/MyNewWOProject.xcode/project.pbxproj.) This file is not immediately visible in the Finder, so choose from one of the following methods to open the project.pbxproj file:
  8. GUI Method:

    1. In the Finder, Control-click the MyNewWOProject.pbproj or MyNewWOProject.xcode file, then choose Show Package Contents from the shortcut menu.
    2. Open project.pbxproj in a text editor.

    Command-Line Method:

    1. Open the Terminal.
    2. Use your preferred command-line text editor, such as vi or pico, to open the file.

  9. Replace all occurrences of MyWOProject in the project.pbxproj file with MyNewWOProject. This updates PBXBundleReference keys, CFBundleExecutable keys, the NSExecutable key, the .woa directory, several intermediate build directories, PRODUCT_NAME keys, and the application's main jar file.

    Some examples:

    path = "_WO$(SERVER_UNIQUIFIER)MyWOProject.tmp";
    Should change to:
    path = "_WO$(SERVER_UNIQUIFIER)MyNewWOProject.tmp";


    path = "_WO$(CLIENT_UNIQUIFIER)MyWOProject.tmp";
    Should change to:
    path = "_WO$(CLIENT_UNIQUIFIER)MyNewWOProject.tmp";


    PRODUCT_NAME = "_WO$(SERVER_UNIQUIFIER)MyWOProject";
    Should change to:
    PRODUCT_NAME = "_WO$(SERVER_UNIQUIFIER)MyNewWOProject";


    path = MyWOProject.woa;
    Should change to:
    path = MyNewWOProject.woa;


    <string>MyWOProject.jar</string>
    Should change to:
    <string>MyNewWOProject.jar</string>

    Important: Do not modify names of .java files or the .wo directories. Additionally, if you modify any package names in the project.pbxproj file, make sure that you make the appropriate changes to the package statements in your .java source files.

  10. Save the changes to project.pbxproj.
  11. Open MyNewWOProject in Xcode.
  12. Build and run the application. The resulting executable file has the new name of MyNewWOProject, and the URL for accessing the application includes the correctly updated name.
Published Date: Feb 20, 2012