1 |
4528
|
daigle
|
<!--
|
2 |
|
|
* sitemaps.html
|
3 |
|
|
*
|
4 |
|
|
* Authors: Michael Daigle
|
5 |
|
|
* Copyright: 2008 Regents of the University of California and the
|
6 |
|
|
* National Center for Ecological Analysis and Synthesis
|
7 |
|
|
* For Details: http://www.nceas.ucsb.edu/
|
8 |
|
|
* Created: 2008 November 4
|
9 |
|
|
* Version:
|
10 |
|
|
* File Info: '$ '
|
11 |
|
|
*
|
12 |
|
|
*
|
13 |
|
|
-->
|
14 |
|
|
<HTML>
|
15 |
|
|
<HEAD>
|
16 |
|
|
<TITLE>Setting Up a Metacat Eclipse Project</TITLE>
|
17 |
|
|
<!-- unfortunately, we have to look for the common css file in the
|
18 |
|
|
user docs directory. This is because the user docs deploy to
|
19 |
|
|
the top level of the metacat docs on the knb web server -->
|
20 |
|
|
<link rel="stylesheet" type="text/css" href="../user/common.css">
|
21 |
|
|
<link rel="stylesheet" type="text/css" href="./default.css">
|
22 |
|
|
</HEAD>
|
23 |
|
|
<BODY>
|
24 |
|
|
<table width="100%">
|
25 |
|
|
<tr>
|
26 |
|
|
<td class="tablehead" colspan="2"><p class="label">Setting Up a Metacat Eclipse Project</p></td>
|
27 |
|
|
<td class="tablehead" colspan="2" align="right">
|
28 |
|
|
<a href="./metacat-dev-hardware.html">Back</a> | <a href="./index.html">Home</a> |
|
29 |
5316
|
daigle
|
<a href="./building-metacat.html">Next</a>
|
30 |
4528
|
daigle
|
</td>
|
31 |
|
|
</tr>
|
32 |
|
|
</table>
|
33 |
|
|
|
34 |
5311
|
daigle
|
<p> The following are the steps to download Eclipse, load the Metacat project and
|
35 |
|
|
it's dependent projects, set up the environment, and run Metacat via Tomcat from
|
36 |
|
|
within Eclipse.</p>
|
37 |
|
|
|
38 |
|
|
<p> One note, these instructions are based on my development system, which is a Linux
|
39 |
|
|
system. I rarely use
|
40 |
|
|
apt-get install (debian) or yum install (fedora) to install supporting applications
|
41 |
|
|
like Java, Tomcat and Apache. This is because I want a certain level of control
|
42 |
|
|
over where these apps are installed, and I like to be able to install several
|
43 |
|
|
versions side by side so I can switch back and forth in my development environment.</p>
|
44 |
|
|
|
45 |
|
|
<p> My typical approach is to install the application in the /usr directory. Then I
|
46 |
|
|
create a symlink from /usr/local to this install. Any environment variables reference
|
47 |
|
|
this symlink, so I can easily modify the symlink to change the version of the
|
48 |
|
|
application.</p>
|
49 |
|
|
|
50 |
|
|
<p><div class="header3">Install Java (assuming it's not already installed):</div>
|
51 |
|
|
<ul>
|
52 |
|
|
<li>go to <a target="_blank" href="http://java.sun.com/javase/downloads/index.jsp">Java Download Site</a>.</li>
|
53 |
|
|
<li>download the Java SE Development Kit for your platform (I use the regular .bin file, not the
|
54 |
|
|
rpm.bin).</li>
|
55 |
|
|
<li>make the java usr directory: <code>sudo mkdir /usr/java</code></li>
|
56 |
|
|
<li>move the jdk .bin file you downloaded into the java user dir:
|
57 |
|
|
<code>sudo mv jdk-6u19-linux-i586.bin /usr/java</code></li>
|
58 |
|
|
<li>make bin file executable: <code>sudo chmod +x jdk-6u19-linux-i586.bin</code></li>
|
59 |
|
|
<li>run the bin file: <code>sudo ./jdk-6u19-linux-i586.bin</code></li>
|
60 |
|
|
<li>create java symlink in /usr/local: <code>ln -s /usr/java/jdk1.6.19/ /usr/local/java</code>
|
61 |
|
|
<li>add the following lines to /etc/profile (again, this is my preference):<br>
|
62 |
|
|
<code> JAVA_HOME=/usr/local/java</code><br>
|
63 |
|
|
<code> PATH=$JAVA_HOME/bin:$PATH</code><br>
|
64 |
|
|
<code> export PATH JAVA_HOME</code>
|
65 |
|
|
</li>
|
66 |
|
|
</ul>
|
67 |
|
|
|
68 |
|
|
<p><div class="header3">Install Tomcat (assuming it's not already installed):</div>
|
69 |
|
|
<ul>
|
70 |
|
|
<li>go to <a target="_blank" href="http://tomcat.apache.org/download-60.cgi">Tomcat Download Site</a>.</li>
|
71 |
|
|
<li>download the binary core tar.gz file.</li>
|
72 |
|
|
<li>make the tomcat usr directory: <code>sudo mkdir /usr/tomcat</code></li>
|
73 |
|
|
<li>move the tar.gz file you downloaded into the tomcat user dir:
|
74 |
|
|
<code>sudo mv apache-tomcat-6.0.26.tar.gz /usr/tomcat</code></li>
|
75 |
|
|
<li>expand tar.gz: <code>sudo tar -xvzf apache-tomcat-6.0.26.tar.gz</code></li>
|
76 |
|
|
<li>create tomcat symlink in /usr/local: <code>ln -s /usr/tomcat/apache-tomcat-6.0.26/ /usr/local/tomcat</code>
|
77 |
|
|
<li>add the following lines to /etc/profile (again, this is my preference):<br>
|
78 |
|
|
<code> TOMCAT_HOME=/usr/local/tomcat</code><br>
|
79 |
|
|
<code> PATH=$TOMCAT_HOME/bin:$PATH</code><br>
|
80 |
|
|
<code> export PATH TOMCAT_HOME</code>
|
81 |
|
|
</li>
|
82 |
|
|
</ul>
|
83 |
|
|
</p>
|
84 |
|
|
|
85 |
|
|
<p><div class="header3">Download and Install Eclipse:</div>
|
86 |
|
|
<ul>
|
87 |
|
|
<li>go to <a target="_blank" href="http://www.eclipse.org/downloads/">Eclipse Download Site</a>.</li>
|
88 |
|
|
<li>choose Eclipse IDE for Java Developers</li>
|
89 |
|
|
<li>make the eclipse usr directory: <code>sudo mkdir /usr/eclipse</code></li>
|
90 |
|
|
<li>move the tar.gz file you downloaded into the eclipse user dir:
|
91 |
|
|
<code>sudo mv eclipse-java-galileo-SR2-linux-gtk.tar.gz /usr/eclipse</code></li>
|
92 |
|
|
<li>extract tar.gz:
|
93 |
|
|
<code>sudo tar -xvzf eclipse-java-galileo-SR2-linux-gtk.tar.gz</code></li>
|
94 |
|
|
<li>note that Eclipse extracts into a folder named eclipse. I like to rename this
|
95 |
|
|
folder using the SR number or current date, in case I want to put another version of
|
96 |
|
|
eclipse next to it. So: <br> <code>mv /usr/eclipse/eclipse /usr/eclipse/eclipse-galileo-SR2</code></li>
|
97 |
|
|
<li>create eclipse symlink in /usr/local: <code>ln -s /usr/eclipse/eclipse-galileo-SR2 /usr/local/eclipse</code>
|
98 |
|
|
<li>add the following lines to /etc/profile (again, this is my preference):<br>
|
99 |
|
|
<code> ECLIPSE_HOME=/usr/local/eclipse</code><br>
|
100 |
|
|
<code> PATH=$ECLIPSE_HOME:$PATH</code><br>
|
101 |
|
|
<code> export PATH ECLIPSE_HOME</code>
|
102 |
|
|
</li>
|
103 |
|
|
<li>I create a desktop launcher for Eclipse. The command should just be <code>eclipse</code>.
|
104 |
|
|
If that doesn't work, you may need to log out and log in to pick up changes in
|
105 |
|
|
<code>/etc/profile</code>. You can associate the launcher with the eclipse icon
|
106 |
|
|
at <code>/usr/local/eclipse/icon.xpm</code></li>
|
107 |
|
|
</ul>
|
108 |
|
|
</p>
|
109 |
5154
|
daigle
|
|
110 |
5311
|
daigle
|
<p><div class="header3">Get Subversion plugin:</div>
|
111 |
|
|
<p>The subversion plugin allows you to checkout and manage your code against
|
112 |
|
|
an SVN repository</p>
|
113 |
|
|
<ul>
|
114 |
|
|
<li>in eclipse, go to Help/Install New Software</li>
|
115 |
|
|
<li>add the following update site: <code>http://subclipse.tigris.org/update_1.6.x</code>
|
116 |
5154
|
daigle
|
Note this may change for newer versions.
|
117 |
5311
|
daigle
|
Check <a target="_blank" href="http://subclipse.tigris.org/">Subclipse Site</a> for newer versions</li>
|
118 |
|
|
<li>Choose to install all the packages under that site</li>
|
119 |
|
|
<li>After restarting Eclipse, you should see an SVN Repository Exploring
|
120 |
|
|
perspective available.</li>
|
121 |
|
|
</ul>
|
122 |
|
|
</p>
|
123 |
5154
|
daigle
|
|
124 |
5311
|
daigle
|
<p><div class="header3">Check out metacat code:</div>
|
125 |
|
|
<ul>
|
126 |
|
|
<li>In eclipse go to the SVN Repository Exploring perspecitve</li>
|
127 |
|
|
<li>Click in window under svn repositories and chosse "New > Repostory Location ..."</li>
|
128 |
|
|
<li>Add <code>https://code.ecoinformatics.org/code/metacat</code></li>
|
129 |
|
|
<li>Add <code>https://code.ecoinformatics.org/code/utilities </code></li>
|
130 |
|
|
<li>If you are actively working on ecogrid, add <code>https://code.ecoinformatics.org/code/seek</code></li>
|
131 |
|
|
<li>For each repository, open its tree and right click on trunk </li>
|
132 |
|
|
<li>Choose "checkout..."</li>
|
133 |
|
|
<li>Check out as a project using the wizard</li>
|
134 |
|
|
<li>Choose java project</li>
|
135 |
|
|
<li>Name the project in workspace. One thing to keep in mind is that the build
|
136 |
|
|
process relies on the Metacat code being in a directory named "metacat". If you will
|
137 |
|
|
absolutely only have one metacat project, you can name it "metacat". Otherwise, I usually
|
138 |
|
|
name the project something meaningfull, like "METACAT_TRUNK" or "METACAT_1_9_1_RC2". Then
|
139 |
|
|
I create a "metacat" simlink at the same level that points to the checkout that I
|
140 |
|
|
actually want to build.</li>
|
141 |
|
|
<li>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.</li>
|
142 |
|
|
</ul>
|
143 |
|
|
</p>
|
144 |
5154
|
daigle
|
|
145 |
5311
|
daigle
|
<p><div class="header3">Set up Metacat Dependencies</div>
|
146 |
|
|
<p>These dependencies are primarily so you can eliminate reference errors in
|
147 |
|
|
the code and so you can debug when running in tomcat.</p>
|
148 |
|
|
<ul>
|
149 |
|
|
<li>In the Java perspective, hilight the utilities project you checked out.</li>
|
150 |
|
|
<ul>
|
151 |
|
|
<li>In the menu, go to Project > Properties > Java Build Path</li>
|
152 |
|
|
<li>Choose the libraries tab and Add Jars...</li>
|
153 |
|
|
<li>Select all the jar files in the utilities/lib directory</li>
|
154 |
|
|
<li>Switch to the Source tab and remove utilities/src</li>
|
155 |
|
|
<li>Add folder utilties/src/java</li>
|
156 |
|
|
</ul>
|
157 |
|
|
<li>In the Java perspective, hilight the metacat project you checked out.</li>
|
158 |
|
|
<ul>
|
159 |
|
|
<li>In the menu, go to Project > Properties > Java Build Path</li>
|
160 |
|
|
<li>Choose the libraries tab and Add Jars...</li>
|
161 |
|
|
<li>Select all the jar files in the metacat/lib directory EXCEPT the
|
162 |
|
|
utilities.jar if it exists.</li>
|
163 |
|
|
<li>Select all the jar files in the metacat/lib/lsid_lib directory</li>
|
164 |
|
|
<li>Select all the jar files in the metacat/lib/spatial/geoserver/WEB-INF/lib directory</li>
|
165 |
|
|
<li>Choose to Add External Jars and select all the jar files in /usr/local/tomcat/lib</li>
|
166 |
|
|
<li>Switch to the Projects tab and add the utilities project.</li>
|
167 |
|
|
</ul>
|
168 |
|
|
<li>These settings should remove all but the most persistant error markers in
|
169 |
|
|
the code.</li>
|
170 |
|
|
</ul>
|
171 |
|
|
</p>
|
172 |
|
|
|
173 |
|
|
<p><div class="header3">Build Metacat</div>
|
174 |
|
|
<p>A full description of how to build Metacat is beyond the scope of this document, however
|
175 |
|
|
you should be able to do all Ant tasks from within eclipse.</p>
|
176 |
|
|
<ul>
|
177 |
|
|
<li>In Eclipse choose Window > Show View > Ant</li>
|
178 |
|
|
<li>You should see an Ant window pop up on the right.</li>
|
179 |
|
|
<li>In the Metacat project, select the build.xml file and drag it to
|
180 |
|
|
the Ant window.</li>
|
181 |
|
|
<li>All Ant tasks should now be runnable from this window</li>
|
182 |
|
|
</ul>
|
183 |
|
|
</p>
|
184 |
5154
|
daigle
|
|
185 |
5311
|
daigle
|
<p><div class="header3">Set up Tomcat in Eclipse:</div>
|
186 |
|
|
<ul>
|
187 |
|
|
<li>Get tomcat eclipse plugin at:
|
188 |
|
|
<a target="_blank" href="http://www.eclipsetotale.com/tomcatPlugin.html">Tomcat Plugin Site</a></li>
|
189 |
|
|
<li>Extract zip: <code>sudo unzip tomcatPluginV321.zip</code></li>
|
190 |
|
|
<li>move resulting dir into Eclipse plugins directory: <br>
|
191 |
|
|
<code> sudo mv com.sysdeo.eclipse.tomcat_3.2.1 /usr/locale/eclipse/plugins</code></li>
|
192 |
|
|
<li>Restart Eclipse. You should see some Tomcat icons in the toolbar.</li>
|
193 |
|
|
<li>In Eclipse go to Window > Preferences > Tomcat </li>
|
194 |
|
|
<li>Set Tomcat version to correct value (6 recommended)</li>
|
195 |
|
|
<li>Set tomcat home to directory where you just installed tomcat
|
196 |
|
|
(<code>/usr/local/tomcat</code> if you used my instructions).</li>
|
197 |
|
|
<li>Under "Advanced", add Metacat and Utilities projects to Tomcat classpath</li>
|
198 |
|
|
<li>You can now start and stop Tomcat using the Tomcat menu or toolbar items.
|
199 |
|
|
The application output will show up in the console tab in Eclipse. Note
|
200 |
|
|
that there is also now a Debug perspective. You can perform the standard
|
201 |
|
|
debugger actions on your running Metcat instance via this perspective.</li>
|
202 |
|
|
</ul>
|
203 |
|
|
</p>
|
204 |
5154
|
daigle
|
|
205 |
5311
|
daigle
|
<p><div class="header3">Advanced Operations:</div><p>
|
206 |
|
|
<p>There are many more advanced operations that can be performed from within
|
207 |
|
|
Eclipse, including running individual classes, regular expression searching,
|
208 |
|
|
jumping to implementation source and more. Please refer to
|
209 |
|
|
<a target="_blank" href="http://www.eclipse.org/documentation/">Eclipse Documentation</a>
|
210 |
|
|
for more information.</p>
|
211 |
5154
|
daigle
|
|
212 |
4528
|
daigle
|
<br>
|
213 |
|
|
<a href="./metacat-dev-hardware.html">Back</a> | <a href="./index.html">Home</a> |
|
214 |
5316
|
daigle
|
<a href="./building-metacat.html">Next</a>
|
215 |
4528
|
daigle
|
</ul>
|
216 |
|
|
|
217 |
|
|
</BODY>
|
218 |
|
|
</HTML>
|