Sun Java Studio Creator 2 and Version Control: Part 1

Sun Java Studio Creator 2 and Version Control: Part 1

Sun Java Studio Creator 2 takes advantage of the NetBeans Platform Version Control System (VCS). Specifically, Creator supports CVS and Visual Source Safe(VSS).  I'll be focusing some blog entries on doing version control using Creator and CVS.

Creator web applications consist of files organized at the project level. The project file structure can be seen in the "Files" window next to the "Projects" window.

Preparing a Project For Version Control

Library References

Before adding a project to CVS, you must make sure all the necessary files are part of the project. You don't want logical references outside the project structure. The NetBeans project structure supports a logical library reference. A library reference is a collection of Jar files. Creator ships with some standard library references that are part of each developers environment. To make a project “portable” you must be careful defining library references. Library references are typically defined either at the user level or at the System level. This means if you define a library reference, that library reference definition will be in your user directory and not in the project file structure. If you need to add Jar files to your project, avoid using libraries references. Instead, you need to add the Jar file to a directory within the project structure. For example, if you are using the Hibernate framework and want to add “hibernate3.jar” to your project, you would do the following.

  1. You should first create a directory called “projectlibs” within the project.  like the following.

    Library reference

  2. Next, you'll add the “hibernate.jar” file to the directory by doing an "File->Add existing Item->Other". Note that you'll have to move (cut/paste) the Jar file from the source folder because that's where Creator puts it by default.  
  3. Lastly, you'll do an “Add Jar/Folder...” from the project “Libraries” node and add the Jar file. This will ensure that the Jar file can be controlled by CVS and available to all team members working on the project.

AJAX Components

When you drop an AJAX component on a web page in Creator, Jar files are added to the project directory “lib/complibs”. Also, a library reference is created to reference this set of Jar files. The library reference is created in your user directory. If you open your library references and select the AJAX Blueprint that was created, you'll see something similar to the following.

library reference

When the first AJAX component is dropped on the designer, a library reference is created in your user directory.  The file where the library reference is created is "build.properties".  Since the user directory can't be included with the project, you'll need to take steps to add the Jar references that were added to the project "lib/complibs" to the project libraries.  To do this, right-click on the "Libraries" node under the "Project" window and select "Add JAR/Folder..." like this.

Add Jar

You will need to add these files from the "lib/complibs/ui.complibxxxxx" directory.

  • ui.jar
  • ui-dt.jar
  • shale-remoting.jar
The following figure shows what this will look like.  Notice that you have to select "package" for the "ui.jar" and the "shale-remoting.jar" so they will be deployed with the web application.   While you're in this dialog, remove the reference to the "xxx_Design-time_BluePrints_AJAX_Components".

Adding Jars

You'll also need to remove any library references in your project to the AJAX runtime library references in your user directory "build.properties".  This is a little more involved.  You'll have to search for all references to the runtime library reference in the "nbproject" directory.

From the "Files" window, select the "nbproject" directory, right-click and select "Find...".  Enter "Runtime_BluePrints" as the search string and search.  You'll be presented with a set of hits at the bottom of the IDE.

Double-clicking on each entry will open the file and position the cursor at the hit in the file.  You need to remove each line found in every file.  In the "project.xml" file,  you'll need to delete the entire "<library>" element for the reference.   Repeat the find/replace process for the string "Design-time_BluePrints".

The good news is you will only need to do this once per project for AJAX components.  The next time you open the project, you may see a dialog like the one below.  Simply press the "Regenerate" button and proceed.

Regenerate

Testing the Project

Now you should test your project for "portability".  That is, you want to test whether or not you've successfully taken care of file references that are outside the project file system.  To do this, simply MOVE the entire project folder, "webapplication1" for example, to a different location.  Once you've moved the project folder, try to open it in Java Studio Creator from the new location.  If the "Project" window node for your project shows up red.  If you open the "Resolve Reference Problems..." as show below, you can see the resources that you missed.

Missed resources
Also, do a "clean and build project" from the project node to make sure you've included all the necessary external Jar files.

Adding the Project to CVS

At this point, your project should be ready to add to CVS.  Please check out the article, "Source Code Control in the Sun Java Studio Creator 2 IDE" for details on setting up CVS and adding your project. 

IMPORTANT - The only tip I would add to this is about ignoring certain files.  For sure you want to ignore the "nbproject\\genfiles.properties" from CVS since it represents IDE session specific information.  To do this, go to the "Versioning" window next to the "Palette" window.  Select the "genfiles.properties" file under the "nbproject" directory.  Right-click on the file and select "CVS->ignore".  This will create a ".cvsignore" file in the "nbproject" directory for that file.


Next Time

In my next blog, I plan to discuss a technique for specifying multiple navigation files so multiple developers can add to the page navigation simultaneously.
Comments:

Now that I found your blog, will definitely share with "the folks JB and you had conf call with" in Singapore. If things go as planned, we should have the privilege of having you in Singapore. e1, IT Architect, Sun.

Posted by iwan on August 05, 2006 at 03:18 AM MDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

David Botterill

Search

Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today