In this project you will learn to use some of the team
features
of your preferred IDE (Eclipse or NetBeans).
We will use CVS
source code control system to
allow all members of the class to work on the same project at the
same time, and then to merge in your changes.
This is a real-world
way of working on code; few developers
work on real projects by themselves.
(And even then version control is often useful and used.)
The project is a very simple one.
SayHello.java has a main method you need
to edit.
Add a statement to main to greet the class
by displaying a unique string (so your contribution differs from
other students').
(You are free to add additional code if you desire!)
The purpose is simply to learn to use CVS.
I have created a CVS repository you can access from
the Internet.
This repository contains both the Eclipse and NetBeans project
files, in addition to the initial version of
SayHello.java.
The initial version (with a version number of 1.3
)
has a greeting from the instructor you can use
as a model.
Following the directions below you access the CVS
repository and checkout a local copy of the project you
can work with.
You use this project just like any other Java project.
When you are done making a set of changes (for this project you only
need to add a single line to main), you must
commit your changes.
That updates the repository version from your local version.
During this step you may discover another student has committed some
changes after you had checked out the project.
If so you will merge your changes into the new version.
You can also update your local copy of the project, over-writing
your files with the latest ones from the repository.
You can perform other CVS related operations
with Eclipse or NetBeans.
Please be careful as I have not fully implemented security for the
repository and it would be fairly easy to destroy it!
(Yes I did create a backup of the initial version of the project!)
In particular don't try to edit the version number, that changes
automatically with each commit
.
You can read about using these features your IDE using the built in help system you have learned to use in a previous project. For more information visit the CVS home page.
Creating a new CVS repository is easy, on your own computer using either NetBeans or Eclipse. Setting one up on an Internet server is harder. Linux CVS Repository Setup Directions is a transcript of the steps I used on YborStudent.
Using either Eclipse or NetBeans (you don't have to use both), complete the steps shown below for your IDE to setup a CVS project. Then edit the shared Java program, test it, and commit your changes back to the central repository.
File→Import....
Then select CVS→Projects from
CVS
and click the next button. New CVS Repository Locationform, using the data below. (You only need to this once; Eclipse will remember the repository information so you can select it from the list that shows, next time.)
| Host: | YborStudent.hccfl.edu |
|---|---|
| Repository path: | /var/cvs-repos/cop2805 |
| User: | Your assigned User ID |
| Password: | Ask your Instructor! |
| Connection: | extssh |
| Use Default port: | (use this setting) |
| Save Password: | Leave Unchecked when working at a public computer, such as from HCC! |
Use an existing module.
Once the connection is made a list of modules
will appear.
Select cvsproj.
Click the next button. Check out as a project in the
workspace.
Be sure the Checkout subfolderscheckbox is selected. Click the next button.
If this is a new project, Eclipse will only find the Java
source and not the project's settings files.
In that case you need to select Checkout as a project
configured using the New Project Wizard
.
Use all the defaults, and add the folder
(this is
the package folder, containing the source code).
If done correctly you should see
cvsproj→src→cvsproj
in the project's cvsproj/SayHello.javasrc
folder.
HEAD branch (which means the
latest version) and click the Finish button. src→cvsproj package (folder) to see the
SayHello.java file. Run As... → Java
Application.
(From then on just using Run should work,
since Eclipse remembers the last run configuration used). SayHello.java and add your code.
Make sure the code will compile and run, and displays your
greeting along with the other greetings from your fellow
classmates. Package Explorerpane, and select
Team→commit to save your
changes in the repository.
If you opened the project (which does a CVS
checkout
) a while ago, others may have made changes.
Use
to refresh your local
copy with the current version from the repository
on the CVS server.
Team→Update
You can also interactively merge in your changes with
the changes made others (since you last updated your files
from the repository).
If your commit conflicts with another student's
changes (this can happen when you both work at the
same time), use right-click and select
to include your
changes with the other student's changes (the
one who Team→Mergecommits
last must do this).
Or you can select
.
This will switch to the Team→Synchronize with
repository
prospective which makes it easy to see any conflicts
and fix them.
When done change back to the synchronize
prospective (use the menu at the upper right of the toolbar).
Java
You should explore some of the other items on the Team
menu.
When finished with this project, right-click on the project
and close it.
(This should help prevent accidents
.)
Versioningmenu, select
CVS→Checkout.... CVS root.
Enter the following data:
| Access Method: | ext |
|---|---|
| User: | Your assigned user ID |
| Password: | Ask your Instructor! |
| Host: | YborStudent.hccfl.edu |
| Port: | Leave blank |
| Repository Path: | /var/cvs-repos/cop2805 |
| Remember Password: | Leave Unchecked when working at a public computer, such as from HCC! |
Use Internal SSH, and
enter your password.
(Do not check Remember Password
when working from an HCC computer.)
Click the next button. Module: line.
Expand the entry for /var/cvs-repos/cop2805.
Select the cvsproj→src→cvsproj module.
(If you open that you may see sub-folders, but make sure you
select the cvsproj package folder.)
Then click the OK button. Branch: line.
There is only one branch, so select it
(HEAD).
Then click the OK button. Create Project... button in the
Do you want to create an IDE project from the checked-out sources?dialog.
New Projectwizard that now appears, select
Java→Java Project with
Existing Sources (note this is not the
default).
Click the next button. CVS Project).
Make sure the Create Main classcheckbox, if shown, is unchecked. You can optionally check
Set as Main
Project (a good idea), then click the
next button. Existing Sources screen you see next,
add a source package folder:
Click the Add Folder... button to the right
of the Source Package Folders:pane. Select the
cvsproj→src
folder and click the Open button.
Then click the next button. cvsproj/SayHello.java shows in the
list of included files.
Then click the Finish button.
If you only see
and not
SayHello.java
then you didn't
have the correct folder selected in the previous step.
In this case, hit the cvsproj/SayHello.javaBack
button, click on the folder
to select it, and hit the Remove
button.
Now click the Add folder...
button and try again.
SayHello.java file with your
additions.
Save and run to make sure the modified version is working. Projectspane (or just select a file/package/project and use the
Team menu), and select
CVS→commit
to save your changes in the repository.
(As with Eclipse, if others have made and committed changes
since you last Updatedyour local copy from the repository, you will have to merge your changes with theirs. Only the NetBeans menu item is
Resolve Conflicts...instead of Eclipse's
Merge....)
Team
menu, such as Diffor
Show annotations.
CVS→update
to fetch the current version from the server. Note you can add new files to a project (or a module within a project), and even create new modules in the CVS repository. If you do this, or accidentally delete a file or folder, don't panic! You can always revert the project to a previous version.
All students have an account on the
YborStudent.hccfl.edu Linux server,
that provides command line access using the
SSH
protocol.
You can
download PuTTY
,
a free and easy to install SSH program for Windows.
Using this you can log into YborStudent and run various Linux commands.
One command you may wish to run is
.
This allows you to change your password.
Note!
Only strong passwords will be accepted.
passwd
To end your command line SSH session,
type the command
.
exit
Please see your instructor if you need any assistance with this.
A copy of the SayHello.java Java source code,
the version with your additions (or a later version).
You can send as email to
(preferred).
If email is a problem for some reason, you may turn in a hard-copy.
In this case
the pages should be readable, dated, and stapled together.
Your name should appear on the first page.
Please see your syllabus for more information about projects, about submitting projects.