Monday, November 05, 2007

At what level should I version my source code?

This is a question that comes up regularly when I talk to development teams. And I believe that the answer should always be - at the top level.

If you are using JDeveloper this means at the application level. We adopt this in our own development here and it's my top tip for best practice. Some might want to argue that if their application is broken into a number of different projects then why not version those individually?

One problem with this approach could be cross- project dependencies in your application. Imagine that you work in one project on a day to day basic but there is a dependency on libraries held in another project (let's call it a 'library' project). You might checkout both projects at the beginning of the development cycle but assume that the 'library' project was complete and so you could just work and update your 'working' project. At some later stage, you could run into problems when you want to check in your 'working' project and realise that updates have been made to the 'library' project.

On a practical level, if you are using JDeveloper, you should not only follow my advice and version at the application level, but always ensure that your .jws configuration file is included in source control. This isn't a problem if you using JDeveloper's integrated SVN commands. When you select an application you automatically get the .jws file included.

But what if not all your development team are using JDeveloper? Perhaps you prefer to use Tortoise for your SVN interactions. Or perhaps you have some team members that use Eclipse or another IDE as well as JDeveloper? In this case it is important to ensure that you still place both your 'jws' and your 'jpr' files under source control.

Why? Because JDeveloper's SVN code looks at the state of those files to decide what menu options it makes available. For instance, say an initial import of an application to SVN had been done using Tortoise and the .jws file had not been included. I then check out this into a working copy in JDeveloper and make some changes. When I try to commit or update this working copy using JDeveloper I would expect to get the menu options 'Commit Working Copy' or 'Update Working Copy'. In fact, I would only see 'Import Files' as the .jws files would not be part of the versioned application and so JDeveloper offers you the option to place the application under version control.

I've come across this a few recently. The workaround is to go back to the repository and add the .jws file to version control. This brings the IDE back into kilter and allows you to continue using JDeveloper's integrated SVN support.

Wednesday, October 24, 2007

Connecting to CVS/SVN thru JDeveloper

Here is how simple it is to set up your CVS repository to work in JDeveloper 11g. The first step is to select your Versioning system. SVN and CVS are shipped with JDeveloper 11g. Other supported version control system can be downloaded via Check for Updates.
Now you can view the SVN or CVS Navigator from the View menu. Use the context menu of the parent node in the open navigator to create a new repository connection.
For CVS enter the details of your CVS repository in the wizard; including your access method and authentication style and user id (set by your CVS repository administrator). Test the connection and Finish the wizard. You are now able to browse the repository and Check Out a module using the context menu to begin work. To add a new application to the repository select Import Module from the Versioning menu.

For SVN enter the URL to the repository, user name and password, again Test the connection and click OK to complete the connection. As well as being able to browse the repository you can do other things such as create new remote directories from the context menu of the connection in the navigator.

To add a new application to the repository using either CVS or SVN, select Import Module from the Versioning menu.
By returning to the Versoning menu and selecting another version control system you can invoke the navigator for that system - without losing any of the connections you have to other systems.