Tapestry Training -- From The Source

Let me help you get your team up to speed in Tapestry ... fast. Visit howardlewisship.com for details on training, mentoring and support!

Thursday, January 12, 2006

Subclipse new project tricks

I go through a little rigamarole every time I start a new project in Eclipse; I use a Subversion repository (locally, or on Apache, or on JavaForge) and I use the Subclipse plugin.

Subclipse is nice, but weakest on the things you do least often, such as creating a project.

I always start in the SVN Navigator; I create my new folder for my project.

I then share the project; I chose the "Use specified folder name". Next, I hit the browse button and select the folder I just created in the navigator.

Back to the Share Project dialog; the cursor will be in the folder name field, and the text "New Folder" will be selected, ready for me to type "trunk".

When I hit OK, we switch over the a synchronize dialog to do the initial checkin. The bin folder will be in the list of resources to check in ... simply uncheck it for now. Then hit OK to check everything else in.

Because you didn't check in the bin folder, your project will appear dirty. That's OK. Now comes the real trick:

  • Execute a "Replace With Latest" (not an update) on your project.
  • Close and Re-Open your project (to get rid of the .svn folder that shouldn't be displayed, but is)
  • Now, use the Team > Add to svn:ignore context menu item on the bind folder
  • Finally, check in your changes (which will appear to be a change just to the project folder itself ... that's where svn:ignore data lives)

Why is this necessary? Somehow during the initial check in, the local project gets out of synch with the repository. I know not what or why, but it's been very consistent against every repository I use, so I think it is a Subclipse problem. If you don't do the replace with latest trick, you will get incredibly annoying SVN errors when you try to mark bin to be ignored ... you just won't be able to check in your project.


Mark Phippard said...

The latest version of Subclipse (1.0 RC2) will create missing intermediate directories so you do not have to create them first. Of course, you would have to type them all into the Use specified module name field since you would not be able to pick them. That being said, if you do use the URL chooser, there is also a right-click option within it to create folders, so you do not have to switch views first.

When I share a project, I usually hit Cancel on the commit dialog. I then go back and use the Add to Version Control and Add to svn:ignore options as needed and then do a commit. This lets you do it all in one commit.

The latest versions of Subclipse show the dirty decorator if there are unversioned (and un-ignored) items. Since you bin folder initially falls into that category, that is why the project is dirty.

Finally, when you add the bin directory to svn:ignore and try to commit, you will get an Out of Date error. This is because the project folder is not at the latest revision due to the way Subversion mixed-revision working copies work. You just have to do Team -> Update on the project prior to committing the property change. Subversion does not allow folder properties to be committed unless the folder is at the HEAD revision. The folder was at the HEAD revision when IT was committed, but when you do the second commit to add the files, the project folder itself is now out of date until you do an Update.

Massimo said...

Just updated to 0.9.104 which seems to be 1.0RC2 and i hope to be able to commit to a dav accessed repository protected by a custom certificate and a custom certificate authority.

After all they say in the change log they fixed it in JavaSVN