IDE Integration: DSpace, Eclipse and Tomcat Video Tutorial
This is a video tutorial broken into three parts which describe the steps necessary to setup DSpace using the Eclipse IDE environment and integration with Tomcat. Eclipse is not the only IDE available, nor is this the only way to configure Eclipse – however it is a clean and relatively simple method that will work for most developers.
The tutorial assumes that you have several pieces of software already installed before beginning the eclipse integration. The DSpace manual covers installing & configuring these tools for use with DSpace:
Other helpful tools to have available but not strictly required:
Part I: Installing and Configuring Eclipse Plugins
One of the strengths of the Eclipse platform is the ability to extend its feature through the addition of plugins. This tutorial requires five plugins which help make developing DSpace within Eclipse easier.
1) Database Development Tools
Use the pre-configured plugin site. Go to "Europa Discovery site -> Database Development" and select the checkbox.
2) Web and J2EE Development
Use the pre-configured plugin site. Go to "Eurpa Discovery site -> Web & J2EE Development" and select the checkbox.
3) Subclipse SVN Plugin
Use the standard plugin installation method from the remote URL: http://subclipse.tigris.org/update_1.2.x. Use http://subclipse.tigris.org/update_1.6.x for the latest stable branch (with Eclipse 3.4.2).
4) Maven Integration Plugin
Use the standard plugin installation method from the remote URL: http://m2eclipse.codehaus.org/update-dev. Use http://m2eclipse.sonatype.org/update/ for the latest stable branch (with Eclipse 3.4.2). Note also that all components will work with 3.4.2 JEE release save AJDT (disable this dependency if you are not using the AJDT plugin).
5) SysDeo Tomcat Plugin
There is no remote URL available for this plugin, you must download and install it manually. First download the plugin from: http://www.eclipsetotale.com/tomcatPlugin.html Next, unzip the plugin into eclipse/plugins. Finaly restart Eclipse with the "---clean" option so that it recognizes the new plugin.
Next the SysDeo Tomcat plugin needs to be configured. Select Eclipse -> Preferences -> Tomcat, and then select the appropriate version of Tomcat, setting the home and base location for your Tomcat installation, setting the classpath to include tools.jar (Windows & Linux) or classes.jar (Mac OS X), and finally provide the tomcat manager username and password.
Part II: Building DSpace
This part will cover how to build and deploy DSpace from within Eclipse. First we will download DSpace and configure the several Eclipse projects that it contains. Next we will set up a series of Maven tasks to automate the build processes. Then we will perform the optional fresh install of DSpace from within Eclipse. Finally, specific projects will be configured for use with Tomcat.
1) Downloading DSpace
First we need to check out the DSpace source code from SVN. To do this go to the SVN Exploration perspective, add a new repository location "https://dspace.svn.sourceforge.net/svnroot/dspace/". From the new repository locate the dspace-1_5_x branch and checkout all the subdirectories as projects. After SVN has finished downloading all the code, switch back to the Java perspective and select all the projects. Right click on the set and select "Maven -> Enable Dependency Management", Eclipse will then take a moment to rebuild the workspace, and then select "Maven -> Update Source Directories". After the workspace has finished rebuilding all compile errors should be resolved.
2) Configuring Maven Tasks
Maven is the new build system introduced for DSpace 1.5 which automates the dependency management between the various sub projects. Open the "External Tools Dialog" and create four Maven-based tasks:
- DSpace Clean
- DSpace Assemble
- XMLUI Package
- JSPUI Package
- OAI Package
- LNI Package
Part III: Installing & Deploying DSpace
1) Perform a fresh install
Once DSpace has been packaged and assembled you can perform a fresh install. Located inside the target directory for the main dspace project you will find the binary distribution for DSpace. First edit the configuration file, making sure you at least update the dspace.dir, db.username, db.pasword, and db.url parameters. Next ensure that the database is created correctly. Then finally run the ant process to perform a fresh install.
2) Configure Maven tasks for Tomcat
In part II of this tutorial we configured a set of Maven tasks to build various parts sub projects of DSpace, these will need to be modified to work with tomcat. The problem is the dspace.cfg parameter needs to be included inside the webapplications which is not traditionally performed until after a generic binary distribution is build for DSpace. To get around the problem we need to add a "dspace.config" parameter to the maven tasks. This way when maven builds the various projects it will configure the webapplications as well.
3) Deploying DSpace to Tomcat
Each webapplication project, dspace-jspui, dspace-oai, and dspace-xmlui need to be configured as Tomcat projects. Once they are configured correctly you may update their context with tomcat, reload their context, start and stop tomcat all from within Eclipse.