CSci 435/535: Homework 2

Implementation Tools #1

Due Monday, Feb 7th by 11am

In order for this homework to work right, you need to clean out any old junk from any previous failed attempt to do it. Delete the <WORKSPACE>/HW2-Tools directory if you did a previous checkout. Also delete the ~/.eclipse directory. Note that this will blow away your settings, so you will need to re-import any other projects that you may have been working on.

Summary

This is an introduction to Subversion, Ant, and Eclipse. General instructions for accessing our repository are on the class webpage. You will need to consult the Subversion book on the exact syntax of the various svn commands.

Setup

CS Environment

I've put a special version of svn in ~coppit/bin. You'll need to update your path to see them. The "special" part of the new svn is that it will set your umask so that you don't damage the permissions of files in the Subversion repository. While we're at it, we'll set up some environment variables for Apache Ant.

On the CS machine, edit your shell startup file so that it sets the PATH and ANT_HOME environment variables. The file you need to edit depends on your shell. It's most likely ~/.cshrc. If so, here's what you need to add:

setenv ANT_HOME /home/f85/coppit/classes/csci435/ant
set path=(/home/f85/coppit/bin $ANT_HOME/bin $path)

Log out and log back in to make the changes go into effect. If it worked,

echo $ANT_HOME
echo $PATH

will display something reasonable. The exact syntax of the set commands will depend on your shell. If you have any problems, help each other on the forums.

Home Environment

If you've got your own programming environment at home, you need to install Eclipse, Subclipse, and Ant. To install subclipse, go to Help → Software Updates → Find and Install in Eclipse, add the remote update site http://subclipse.tigris.org/update, then install the package. Their website isn't the most responsive in the world, so you may have to try a couple times. Also see the Subclipse website at http://subclipse.tigris.org for other installation options.

Get Apache Ant from http://ant.apache.org/. Installation is easy.

Another issue: svn+ssh in subclipse will fail if you haven't previously stored the host key. Be sure you ssh to the machine at least once to store the key before you try to add the repository in subclipse.

Assignment

Eclipse is under /usr/local/eclipse. Techie has installed Subclipse already. A user's manual for Subclipse is at http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=1732.

You must do the following step by 8am Friday.

Check out the "HW2-Tools" project from the repository.

  1. In Eclipse, go to Windows → Open Perspective → Subversion Repository Exploring. Add a new location. Here is the project path svn+ssh://<USERNAME>@th101c-1.cs.wm.edu/scratch/coppit/svnroot/HW2-Tools. Drop the "HW2-Tools" part for the root. Enter your username and password, and check "validate connection".
  2. Open up the HW2-Tools, and check out the trunk as a project.
  3. You'll notice that Subclipse creates a new location for the trunk. In the properties for that location, re-enter your username and password.
  4. Switch to the Java perspective, and you should see the project. You may have to refresh the project to see the newly checked out files.

Between 8am and 10am on Friday, I will make a change to the files so that the assignment will work right for the first person to do the remainder of the assignment.

You must do the following steps after 10am Friday.

  1. In Eclipse, make a change to src/HelloWorld.java as per the instructions at the top of the file.
  2. Try to commit your changes to HelloWorld.java by selecting Team → Commit from the right-click menu. Enter a message saying what you changed for the commit comment.
  3. You should encounter a checkin conflict. (It will complain that your version is out of date.) You'll need to update your local copy.
  4. Compare your version to the latest version in the repository. (Right click the file, then compare with...)
  5. Update the file in order to merge the conflict into your version.
  6. Resolve the conflict by editing the file and forcing your change to override the other one. After you've resolved the conflict, you'll need to mark it as resolved. Once you have, complete your commit. (NOTE: You may get a message about something not being implemented yet. It appears harmless.)
  7. Edit the file src/HelloEveryone.java as described at the top of the file.
  8. Try to check in HelloEveryone.java. You'll need to update your local copy, but notice that you don't get a conflict this time. (Do you know why?) Finish your checkin.
  9. Your changes are now in the repository.
  10. Compile and run the programs in Eclipse, using Run → Run As → Java Application.

Apache Ant in Eclipse

When you compiled the code in the previous step, Eclipse used its built-in build manager. Now we'll set up Eclipse to use an Ant build.xml file that we'll distribute with our code. That way you don't have to use Eclipse to build the code.

  1. Select HW2-Tools, then Project → Properties. Select Builders → New.
  2. Next select Ant Build, and click the OK button.
  3. Give the builder the name "Ant Builder". Then browse the workspace and select build.xml. Choose HW2-Tools as the base directory.
  4. Click OK.
  5. Build the project again, and you'll see Ant being invoked instead of the normal Eclipse builder.

Subversion and Ant Without Eclipse

If you don't like Eclipse, you can still work on the project as long as you have subversion and Ant. You should have ant working properly after doing the setup step above.

  1. Check out the code using svn checkout svn+ssh://<USERNAME>@th101c-1.cs.wm.edu/scratch/coppit/svnroot/HW2-Tools/trunk myhw2

  2. Look at a log of all the changes: cd myhw2, svn log

  3. Ant uses the build.xml file that you got out of the subversion repository to tell it how to compile your code. Type ant to compile the source files.
  4. Now run ant clean to clear the .class files out.
  5. Re-compile the code, but save the output this time: ant > $USER.ant_output. Email this file to csci435@coppit.org to get credit for this part of the assignment.

Grading

75 points total

Back Back to CSci 435/535 Homepage.

Last changed February 03 2006 10:00:46. David Coppit, coppit@cs.wm.edu

There have been 1221257 hits since Thu Jun 9 14:49:55 2005

Valid CSS!
Valid HTML 4.01!