Getting started with eclipse:
eclipse, getting.
www.eclipse.org version 2.1.x
www.omondo.org free eclipseUML plugin (the jar installer)
The latter can be run after eclipse is installed using
java -jar [downloadname].jar
and following the prompts.
Starting.
eclipse terminology
workspace to hold one set of work
"project" is a subset of that you're working on
projects give particular views: java, etc.
A workspace in this case is the SPP project (or
the code parts thereof)
The projects we'll create are the main one,
for developing core code, and a second dependent
project for developing portlet code.
requirements:
fast(ish) processor
oodles of memory! it'll swap on this laptop.
I've run this highly successfully over christmas using
a laptop (running debian unstable and the latest java 1.4 from sun)
with 1GHz intel and 256MB of memory; this sufficed to run
eclipse, tomcat, plus a slew of the usual unix servers.
CVS checkout of project.
open CVS perspective ("open perspective" button on
the top left just under the menu)
add cvs.ilrt.org repo
your username, no password
(use ext connection)
requires CVS_RSH set up correctly
That is, you should be able to perform
command-line CVS operations successfully.
spp/src checkout as... java project.
name it spp-core
this will be where you work with the core code
(and, in fact, everything other than the portlets)
remove all source directories at this stage!
We'll select them later.
ant setup.
run / external programs / new ant...
classpath for ant:
you can use an external ant (that's what I did)
(jt: I had problems with this so I used the internal one
in this case you will need to add jars to the classpath:
e.g.: the deploy task needs catalina-ant.jar (found in
tomcat4/server/lib) and both deploy and deploy-patch
need bsf.jar and js.jar)
add to favourites: deploy-patch, build, deploy.
also check-dependencies.
You will need to create a new ant task for each of these
which will show up on your run/external tools menu.
check-dependencies
set this one up first and run it. It will pull down bsf.jar and js.jar.
You'll need to add these to the classpath for other ant tasks.
Remember to refresh your directory listing in eclipse for the new
downloads to show up.
clean
deploy-patch
at the moment need tomcat nearby
So you should know where you've got this installed.
deploy
The "build" target shouldn't be necessary since eclipse
keeps your code compiled as you go.
Here's the steps you need to take to set up an external ant task:
- open 'external tools', select 'ant build' and choose 'new'
- give your new task a name
- in this example we'll set up a task to run the newsfeed tests, so call it
something like 'spp test newsfeed'
- main tab:
- location: browse the workspace and select your src/build.xml
- base directory: browse the workspace and select your src directory
- arguments:
- these depend on the task you are setting up
- in this example we need:
'-Dspp.package=newsfeed'
'-Dspp.src.dir='
(in this example: ${workspace_loc:/spp-src})
- targets tab:
- de-select 'help'
- select the task you want to run, e.g. 'test-core-package'
- classpath:
- again this depends on the task you are running
- in most cases you'll want to switch off the 'use global...'
- in this example we need to add the junit jar
- add it from the dependencies/test dir
- as mentioned above if we were creating a 'deploy' task
we'd need the catalina-ant.jar from your ant/lib directory
- apply and run
- repeat this process to set up all the ant tasks you need
Java editing
We configure the java project AFTER a first successful deploy-patch
First, we configure the spp-core project. Our goal is only
to get the editing and compilation of the core/ code working here.
We'll deal with portlets in a bit.
Run the ant external task, deploy-patch. This will grab dependencies
(you can get them by hand if you prefer) and expand the jetspeed
war into the destination directory in your tomcat directory.
Note that you may have to recreate your build.properties file
before this runs successfully.
Once this is done, right-click on the spp-core project in the
navigator and choose "properties".
The java build properties are as follows:
source directory is core/
exclude **/*Test* - although this will change.
config of classpath
(One potential gotcha here: Once check-dependencies has been run it is worth
refreshing the dependencies folder in the package explorer, otherwise
the browsing widget can display a stale list of jar files when
configuring the build classpath for a project.)
internal jar files:
dependencies/lib - add every .jar in here
dependencies/libnoinst - add every .jar in here
external jar files:
You'll need to navigate to your tomcat installation.
tomcat/common/lib - add servlet.jar
tomcat/common/endorsed - If there are any .jar files in here,
add them too.
config of dest dir
(note that this has moved slightly to facilitate eclipse use)
Browse to:
class/core
All your core .java files will be compiled into here.
exports:
export spp-core (could expose more here, we'll see later)
export the servlet.jar file from tomcat
Once you set this up it chugs away to itself for a while (few seconds
or a few minutes depending on your machine).
You now have a working spp-core project.
Portlets
These live in a separate subproject.
Right-click in the navigator view.
new... java project, call it "spp-portlets".
link to source directories:
remove all default source directories.
Add a new source directory, "common":
Advanced>>
Link to... and navigate to your spp-core/portlets/common
Then find the java subdirectory of this and
make that a source directory.
Repeat the process for:
glue, newsfeeds, xsearch, alerting, and the other
subdirectories of "portlets".
Compiled class file destination: browse...
Advanced>>
link to spp-core/class
destination directory, class/portlets (you might need to create this)
dependency projects:
tick spp-core (we need the stuff exported by sp-core to build our portlets)
external jar files:
navigate to your tomcat/webapps/spp/WEB-INF/lib and select all *.jar files.
CVS checkin etc
You edit core code using the spp-core project. Use the "package explorer"
view in the navigator.
You edit portlet code under the spp-portlets project.
CVS operation is done by right-clicking in the navigator and choosing team/...
However, CVS operation only works on the parent project (ie, all cvs
operations must be done under spp-core). Under spp-projects, you'll have
a much reduced set of CVS operations available.
CVS operation works just like the command line, but there are some tools
that make your life _much_ better.
The "update" works like "cvs up". The "commit" works like "cvs ci". The
"add to version control" works as you expect too.
If you select "synchronise with repository" then you'll open up the CVS
synchronisation view (you probably want to drag this to make it larger).
This lets you view changes that are pending in the central repo, and local
changes. It'll also show you the diffs in a diff viewer. It's very pretty.
From this view you can selectively update and commit changes.
OMONDO plugin
getting and installing
The java -jar installer.
In a nutshell, for class views:
- right click on a package, "UML/new class diagram"
and it does everything for you.
You can drag classes and interfaces onto the diagram.
- Do not check in your ".uml" directory (team/add it to .cvsignore)
- You _can_ check in your individual diagrams.
From the diagram, double-click on a method to jump to
the definition in the editor.
Have a tinker with this!
other
Java editing is very very good. Things to try: F2 to open the "completion"
hints box when typing the name of a class, a method, etc.
F3 to navigate to a method's definition.
"open type hierarchy" to show an explorer view of the classes in your
project (interfaces, what implements them, etc).
Errors and suggestions are shown by clicking on the "!" on the left-hand
margin of the java editor. You may get several suggestions to fix the problem.
Double-cloicking on one will apply it.
The source/... and refactor/... menus are very good. If you use these
to rename methods, the code can be automatically searched and all appropriate
changes made for you. (You can preview the changes).
The "tasks" list can be sorted to show errors and warnings. You can
use "add task" to stick something on this list as a quick aide memoire.