Eclipse Works With Preexisting Code, But Not Well

[Cross-posted from the Forum One Tech Blog]

I recently upgraded Eclipse PDT to the most recent version, and I decided to figure out something that had been bugging me: why couldn’t Eclipse use a project I’d already checked out via the command line to the same workspace?

A colleague suggested that I could indeed do it, and that I just needed to start a new project but check “Create project from existing source.” This does work, but it has a couple of restrictions that explain why I was having so many problems and why it’s kind of useless for me.

  1. Projects from existing sources cannot be in your workspace. I have no idea why this restriction exists. I could understand why starting a project inside another project would be bad, but all Eclipse has to do is add a couple of extra files to a directory. Nonetheless, all the sites I’d set up in my workspace and had been using other text editors to edit were unusable. Coda, by contrast, will happily take over an existing project, no matter where it is or what is in it. Interestingly, you can set up a workspace inside another workspace, so I could get around this by creating another workspace that pointed to a subfolder of my current workspace that contained the source code I wanted to use.
  2. If using subversion, Subclipse will not be able to work with your checked out copy if the versioned files are in a subdirectory of your project. This is also strange to me. In Drupal, for example, we only version the sites/all directory and use Drush to update the main application. In other projects, we have versioned code outside the public root and create the public root from a tarball we keep in the repository. Since these files have configurations that shouldn’t be versioned, I want to be able to edit them in Eclipse while using Subclipse to control the versioned part. Sadly, this restriction means I can’t do that.

So my workflow is still to create subdirectories, including a public root, in my workspace by hand, and then importing the project from Subversion with Eclipse’s Import function. These seem like pointless restrictions to me. If anybody knows a workaround, I’d be grateful.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.