DevelopmentEnvironment_pt |
|
Your trail: |
This is version 1.
It is not the current version, and thus it cannot be edited.
[Back to current version]
[Restore this version]
This page describes how to setup your development environment to compile/deploy AppFuse or StrutsResume from the command line. After setting this up, you might want to checkout HowTo Run Ant in Eclipse. This is how I currently have things setup and what I advise clients to use when we use AppFuse as a baseline for webapp development.
Table of Contents
- Download - links to download the JDK, J2EE, Tomcat, Ant and MySQL
- Install - detailed instructions on where to extract/install all of the above packages
- Configure - how to configure your environment variables
- Additional Tips - other tools I recommend using
Download
- Download the latest JDK (J2SE SDK) from http://java.sun.com. As of 07/12/2005, this is 1.4.2_08. AppFuse should work with 1.5 if you'd like to use that. Here's my experience. Note that Cactus has been removed from AppFuse in 1.6 and Cargo (used for testing JSPs) doesn't work with Tomcat 5.5.x yet.
- Download the latest Tomcat release from http://jakarta.apache.org/tomcat. At the time of this writing, it's 5.0.28. DON'T get the LE version or you'll have to add DBCP (database connection pool) and JavaMail (for e-mail) JARs.
- Download the latest Ant release from http://ant.apache.org. AppFuse 1.6+ requires 1.6.2 or greater.
- Download the latest MySQL release from http://www.mysql.com. Currently, this is 4.0.21.
I usually put all these downloads in a "Downloads" folder - in fact, I plan on starting to pack around a CD with all of these libraries on them - nice to have when traveling to new clients and networks are slow.
Install
Make sure you have WinZip installed (for Windows) or gnutar for OS X before installing these packages.
- Create a "Tools" and "SDKs" folder on your hard drive. On Windows, I create these at c:\Tools and c:\SDKs. On *nix, I usually do /opt/dev/tools and opt/dev/sdks.
- Create Environment variables for these folders - SDKS_HOME and TOOLS_HOME (optional)
- Install the J2SE SDK (a.k.a. JDK) in the SDKs directory - keeping the directory names intact.
- Install Tomcat in the Tools directory - I usually name the install directory "jakarta-tomcat-x" where x is the current version (i.e. 5.0.28).
- Unzip/Install Ant in the Tools directory - "apache-ant-x" is what I use for the directory name.
- Install MySQL in the Tools directory. I usually just leave it named "mysql".
- Create a "Source" directory on your hard drive (this is where we'll put all the source code for our projects). On *nix, I usually create a "dev" folder in my home directory.
At this point, you should have a directory structure that looks something like the following:
SDKs -
- j2sdk-1.4.2_05
Tools -
- apache-ant-1.6.2
- jakarta-tomcat-5.0.28
- mysql
Source
Now we'll configure all these tools so that your Operating System knows they're installed.
I'll only show a Windows example and I'll assume the *nix folks are smart enough to figure it out for their system.
- To set Environment Variables in Windows, either go to Control Panel -> System or right-click My Computer -> Properties.
- Click on the Advanced Tab and then click the Environment Variables button.
- Put focus on the second box (System Variables) by clicking on one of the existing values.
- Enter the following variables:
- HOME = c:\Source
- SDKS_HOME = c:\SDKs
- TOOLS_HOME = c:\Tools
- JAVA_HOME = %SDKS_HOME%\j2sdk-1.4.2_05
- ANT_HOME = %TOOLS_HOME%\apache-ant-1.6.2
- CATALINA_HOME = %TOOLS_HOME%\jakarta-tomcat-5.0.28
- MYSQL_HOME = %TOOLS_HOME%\mysql
- Append to the PATH variable: %JAVA_HOME%\bin;%ANT_HOME%\bin;%CATALINA_HOME%\bin;%MYSQL_HOME%\bin
You should now be able to open a command prompt and type "java -version", "ant -version" or "mysql" and not get errors.
Additional Tips
- I use Cygwin on Windows for running Ant and doing all command line things. I install it in %TOOLS_HOME%\cygwin. In my %HOME%\.profile file, I have the following items that might be useful:
alias ls="ls -CF --color"
alias ll='ls -la'
alias tstart=$CATALINA_HOME/bin/startup.bat
alias tstop=$CATALINA_HOME/bin/shutdown.bat
- I use Eclipse on Windows for editing .java files. I install it in %TOOLS_HOME%\eclipse. I still use Ant to build and deploy, but the CVS versions of AppFuse and StrutsResume does contain the .classpath and .project files for Eclipse. Additionally, AppFuse has project files for Intellij's IDEA (version 4.5+). To see how you can run Ant in Eclipse, check out my AppFuse with Eclipse HowTo.
If you're starting work at a new client, I also recommend you do the following to help your development process become more efficient. Most of my clients in the last couple years have not had these in place, that's why I recommend them here.
- Setup a source control system. I prefer CVS because I'm most familiar with it. A nice addon is CVS Spam for HTML-formatted check-in notifications.
- Setup a bug tracking system. Popular (free) choices are Bugzilla and Scarab. The best one I've seen is JIRA (demo), but I've yet to convince a client to shell out the $800 for it.
- Setup a Wiki. My favorite is JSPWiki - which is what this site uses. You can also download this template if you like.
- Setup a development box to host the source control system, the bug tracking system, and a wiki. Install Tomcat on this box and Anthill for automated testing (I run both AppFuse and Struts-Resume on Anthill at home).
- (optional) Install Roller and use it to report your daily status and issues. This will allow your client (or supervisor) to track your progress.
|