|
This page last changed on Mar 12, 2007 by chartra@mcmaster.ca.
Suggested Development Setup for Individual Developers
This page describes how to setup a development environment with Eclipse, Sysdeo, MySQL, and Tomcat. Other environments are equally viable, but this one works.
These instructions should work on Windows/Linux/MacOSX
MySQL
Eclipse
- download and install Eclipse 3.2+ (http://www.eclipse.org/). Following the defaults should be fine, unless you have some other reason for not.
Tomcat
- Download Tomcat 5.5.x (http://tomcat.apache.org/download-55.cgi) and expand into some appropriate directory (e.g., /usr/local/apache-tomcat.xxx). On Windows you can just use the Tomcat installer if you like.
Checkout the MONK project files from SVN
- add the Subclipse plugin (http://subclipse.tigris.org/) - be sure to get the version appropriate for your version of Eclipse
- select the svn view (Window, Open Perspective, Other, SVN Repository Exploring)
- talk to Amit about getting an account, and connection details
- create a new repository location (using the details you got from Amit)
- browse the repository
- right click the MONK project (MONK/trunk) and select 'Checkout As' then choose java project then choose defaults
until finished
- set up source and classpath: choose Project/Properties/Java Build Path/Source/Add Folder then select the three folders: /src/dao /src/service and /src/web.
You'll be prompted to remove the existing folder (the project root folder) - accept. If any of these steps differ, the
end result should be that only three folders (/src/dao /src/service /src/web) should be set as java source folders.
- In the same window (Project/Properties/Java Build Path/Source change the 'Default Output Folder:' from yourProjectName/bin to yourProjectName/webapp/web-inf/classes.
- Now select the 'Libraries' tab in the same window. Choose 'Add Jars' then select all jars in the /lib folder and add them, unless Eclipse has already
picked up the classpath from a .classpath file. In any case verify that all jars in /lib are selected.
- Close the Properties window. You'll most likely get a prompt called something like: "Setting Build Paths" and asking "The output folder has changed. Do you want to remove all generated sources from the old location yourProjectName?". Choose Yes.
Setup Sysdeo
- download and install the Sysdeo plugin (http://www.sysdeo.com/eclipse/tomcatplugin - make sure to get the verions for Eclipse 3.2)
- once installed open the Properties window for the project you created earlier (Project/Properties) and select the Tomcat
option which should now appear in the list on the left.
- check the 'Is a Tomcat Project' box
- Specify something for 'Context Name' - this will be the name of your webapp, e.g., if you specify
'monk' then the url to access the project will be http://localhost:8080/monk. If you'd specified 'monk2'
then the url would be http://localhost:8080/monk2.
- Specify '/webapp' in the field called 'Subdirectory to set as web application root(optional)'.
Build the project with ant
- builds the db including hibernate table generation, default population of user
table with an admin account, compiles and builds webapp into webapp directory for use by Sysdeo
- Open the ant view (Window, Show View, Ant - note that you may have to select Other if
Ant doesn't immediately appear as an option in Show View.)
- Add build.xml (right click on the little image of an ant with a plus sign beside it)
- expand the monk item that should now appear in the view, and then double
click the 'setup-db' target (NOTE: this step assumes you have the mysql 'root' user enabled with no password
and that mysql is running locally on the default port. If any of these settings differ, edit the build.properties
file appropriately.
- now run the build-eclipse-webapp target. This will create an exploded version of the webapp for use by Sysdeo (in a directory called webapp in your project directory.)
Develop
- You can now set breakpoints in the code which will be triggered if you hit a page in a web browser (http://locahost:8080/monk/etc) that invokes the code.
- If you make changes to Java code in the /src folder, Sysdeo and Tomcat should pick up the changes on save, and hot deploy. In some cases, e.g., adding a new constructor, you'll get an error indicating Tomcat can't hot deploy. You'll have to choose the restart option.
- If you make changes to other files like spring configuration files, you'll have to run the 'webapp' ant target to copy the modified files from /src to the /webapp folder, and you'll likely have to reload the webapp by right clicking on the project and choosing Tomcat Project/Reload This Context
- Do not commit any files in the /build /dist or /webapp directories. These directories are only to be generated locally from source.
|