The following are the steps to download Eclipse, load the Metacat project and
it's dependent projects, set up the environment, and run Metacat via Tomcat from
within Eclipse.
One note, these instructions are based on my development system, which is a Linux
system. I rarely use
apt-get install (debian) or yum install (fedora) to install supporting applications
like Java, Tomcat and Apache. This is because I want a certain level of control
over where these apps are installed, and I like to be able to install several
versions side by side so I can switch back and forth in my development environment.
My typical approach is to install the application in the /usr directory. Then I
create a symlink from /usr/local to this install. Any environment variables reference
this symlink, so I can easily modify the symlink to change the version of the
application.
- go to Java Download Site.
- download the Java SE Development Kit for your platform (I use the regular .bin file, not the
rpm.bin).
- make the java usr directory:
sudo mkdir /usr/java
- move the jdk .bin file you downloaded into the java user dir:
sudo mv jdk-6u19-linux-i586.bin /usr/java
- make bin file executable:
sudo chmod +x jdk-6u19-linux-i586.bin
- run the bin file:
sudo ./jdk-6u19-linux-i586.bin
- create java symlink in /usr/local:
ln -s /usr/java/jdk1.6.19/ /usr/local/java
- add the following lines to /etc/profile (again, this is my preference):
JAVA_HOME=/usr/local/java
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME
- go to Tomcat Download Site.
- download the binary core tar.gz file.
- make the tomcat usr directory:
sudo mkdir /usr/tomcat
- move the tar.gz file you downloaded into the tomcat user dir:
sudo mv apache-tomcat-6.0.26.tar.gz /usr/tomcat
- expand tar.gz:
sudo tar -xvzf apache-tomcat-6.0.26.tar.gz
- create tomcat symlink in /usr/local:
ln -s /usr/tomcat/apache-tomcat-6.0.26/ /usr/local/tomcat
- add the following lines to /etc/profile (again, this is my preference):
TOMCAT_HOME=/usr/local/tomcat
PATH=$TOMCAT_HOME/bin:$PATH
export PATH TOMCAT_HOME
- go to Eclipse Download Site.
- choose Eclipse IDE for Java Developers
- make the eclipse usr directory:
sudo mkdir /usr/eclipse
- move the tar.gz file you downloaded into the eclipse user dir:
sudo mv eclipse-java-galileo-SR2-linux-gtk.tar.gz /usr/eclipse
- extract tar.gz:
sudo tar -xvzf eclipse-java-galileo-SR2-linux-gtk.tar.gz
- note that Eclipse extracts into a folder named eclipse. I like to rename this
folder using the SR number or current date, in case I want to put another version of
eclipse next to it. So:
mv /usr/eclipse/eclipse /usr/eclipse/eclipse-galileo-SR2
- create eclipse symlink in /usr/local:
ln -s /usr/eclipse/eclipse-galileo-SR2 /usr/local/eclipse
- add the following lines to /etc/profile (again, this is my preference):
ECLIPSE_HOME=/usr/local/eclipse
PATH=$ECLIPSE_HOME:$PATH
export PATH ECLIPSE_HOME
- I create a desktop launcher for Eclipse. The command should just be
eclipse
.
If that doesn't work, you may need to log out and log in to pick up changes in
/etc/profile
. You can associate the launcher with the eclipse icon
at /usr/local/eclipse/icon.xpm
The subversion plugin allows you to checkout and manage your code against
an SVN repository
- in eclipse, go to Help/Install New Software
- add the following update site:
http://subclipse.tigris.org/update_1.6.x
Note this may change for newer versions.
Check Subclipse Site for newer versions
- Choose to install all the packages under that site
- After restarting Eclipse, you should see an SVN Repository Exploring
perspective available.
- In eclipse go to the SVN Repository Exploring perspecitve
- Click in window under svn repositories and chosse "New > Repostory Location ..."
- Add
https://code.ecoinformatics.org/code/metacat
- Add
https://code.ecoinformatics.org/code/utilities
- If you are actively working on ecogrid, add
https://code.ecoinformatics.org/code/seek
- For each repository, open its tree and right click on trunk
- Choose "checkout..."
- Check out as a project using the wizard
- Choose java project
- Name the project in workspace. One thing to keep in mind is that the build
process relies on the Metacat code being in a directory named "metacat". If you will
absolutely only have one metacat project, you can name it "metacat". Otherwise, I usually
name the project something meaningfull, like "METACAT_TRUNK" or "METACAT_1_9_1_RC2". Then
I create a "metacat" simlink at the same level that points to the checkout that I
actually want to build.
- Note, if you want to check out a certain branch or tag, browse to that tag in the tree and follow the same steps as above.
These dependencies are primarily so you can eliminate reference errors in
the code and so you can debug when running in tomcat.
- In the Java perspective, hilight the utilities project you checked out.
- In the menu, go to Project > Properties > Java Build Path
- Choose the libraries tab and Add Jars...
- Select all the jar files in the utilities/lib directory
- Switch to the Source tab and remove utilities/src
- Add folder utilties/src/java
- In the Java perspective, hilight the metacat project you checked out.
- In the menu, go to Project > Properties > Java Build Path
- Choose the libraries tab and Add Jars...
- Select all the jar files in the metacat/lib directory EXCEPT the
utilities.jar if it exists.
- Select all the jar files in the metacat/lib/lsid_lib directory
- Select all the jar files in the metacat/lib/spatial/geoserver/WEB-INF/lib directory
- Choose to Add External Jars and select all the jar files in /usr/local/tomcat/lib
- Switch to the Projects tab and add the utilities project.
- These settings should remove all but the most persistant error markers in
the code.
A full description of how to build Metacat is beyond the scope of this document, however
you should be able to do all Ant tasks from within eclipse.
- In Eclipse choose Window > Show View > Ant
- You should see an Ant window pop up on the right.
- In the Metacat project, select the build.xml file and drag it to
the Ant window.
- All Ant tasks should now be runnable from this window
- Get tomcat eclipse plugin at:
Tomcat Plugin Site
- Extract zip:
sudo unzip tomcatPluginV321.zip
- move resulting dir into Eclipse plugins directory:
sudo mv com.sysdeo.eclipse.tomcat_3.2.1 /usr/locale/eclipse/plugins
- Restart Eclipse. You should see some Tomcat icons in the toolbar.
- In Eclipse go to Window > Preferences > Tomcat
- Set Tomcat version to correct value (6 recommended)
- Set tomcat home to directory where you just installed tomcat
(
/usr/local/tomcat
if you used my instructions).
- Under "Advanced", add Metacat and Utilities projects to Tomcat classpath
- You can now start and stop Tomcat using the Tomcat menu or toolbar items.
The application output will show up in the console tab in Eclipse. Note
that there is also now a Debug perspective. You can perform the standard
debugger actions on your running Metcat instance via this perspective.
There are many more advanced operations that can be performed from within
Eclipse, including running individual classes, regular expression searching,
jumping to implementation source and more. Please refer to
Eclipse Documentation
for more information.
Back | Home |
Next