To build James V3 in eclipse, read http://james.apache.org/server/3/dev-build.html
A Rough Guide to James Development Using Eclipse
Follow these steps to develop James code using the Eclipse IDE. Use the Eclipse Help and Tutorials to more fully understand the Eclipse concepts and actions described here.
Download and Install Eclipse
Eclipse can be obtained from http://www.eclipse.org/. Follow the installation instructions that come with the download.
NOTE REGARDING CVS
The CVS sections are obsolete. The ASF is migrating to Subversion. We encourage anyone who uses Eclipse with SVN to update this page to provide the appropriate process.
The JAMES project is rooted at svn.apache.org/repos/asf/james. The main development branch for the server is svn.apache.org/repos/asf/james/server/trunk.
Those unfamiliar with Subversion would benefit from the Version Control with Subversion.
Download and install the Subversion plugin for Eclipse
This can be done by downloading it from http://subclipse.tigris.org/ or by adding http://subclipse.tigris.org/update_1.0.x as an update site in the Eclipse update manager (which you can find in the Help menu).
Connect to the Apache SVN repository
- Open the SVN perspective and create a new Repository Location with these properties:
and click on 'Finish'.
Check Out James from the Apache SVN repository
- In the SVN perspective expand the Apache SVN hierarchy to show server/trunk.
- Right-click on 'server/trunk', and select 'Checkout' from the pop-up menu.
- A dialog window will be present where button 'Finish' can be clicked (assuming that a new project is satisfactory).
- From the "New Project Wizard", select Java as the project type and click the "Next" button.
- Specify a project name and location and click the "Next" button.
- Click the "Finish" button to proceed.
Before attempting to configure Eclipse, verify that you have everything you need by running a build of James outside of Eclipse. This will fetch, or prompt you to fetch, any missing components.
- Open a shell and switch to the directory into which James was checked out.
- Run the Ant 'build' script without arguments.
- When this completes cleanly, the checkout is verified.
JAMES trunk is a series of modules (See Modularisation). Each module should be a separate project in Eclipse. It is usually convenient to use a separate workspace for JAMES.
Start by creating a new user library containing all the jars in stage except those starting james-server-*. All projects will need to add this library. The modules use the conventional Maven 2 layout so it's best to set up the defaults for source to src/main/java -> target/classes and src/test/java -> target/test-classes.
For example module, a project needs to be created in Eclipse. This is a slighty labourous process.
Build, Test and Debug Code
As James is a server application I prefer to transfer my updated files to a remote machine, run James' Ant build script (build.bat or build.sh) on the remote machine to update the distribution and then use the Eclipse remote debugger to test. This means that the build, deployment and execution are being tested as they will be used and any changes validated. You can use another session on your local machine as the 'remote machine', the JVM is still 'remote' from the one used by Eclipse. The JVM pointed to by the JAVA_HOME environment variable for the session used to build and run James must be v1.4.0 or above. To debug remotely:
- Uncomment the DEBUG property in the James start-up script (run.bat or run.sh). Now, when you run the script the JVM will pause waiting for a debugger to attach.
In Eclipse select Run>Debug... to open the Launch Configuration widget.
- Select 'Remote Java Application' as the configuration type and click the 'New' button.
- Fill in the configuration properties so that they match those specified in the James start-up script and click the 'Apply' button.
- If you have not already done so, run the James start-up script so that it is waiting for a connection.
- In Eclipse, select the appropriate Launch Configuration and click the 'Debug' button to proceed. James will now start and you will see all of its threads, as they are created, displayed in the Eclipse debugger.
Read the Eclipse Help to understand the many facilities now at your fingertips.
Eclipse is able to build patches against the code stored in the SVN repository. This makes patch creation very easy. Still, remember that the code in the repository may have changed since you imported it. Use the SVN Perspectives Synchronisation feature to ensure you are up-to-date before creating a patch. Eclipse offers the ability to generate a patch that includes new files. This does not work when the new file is in a new directory! It is safest to work in the more conventional manner, building a patch for changed files and submitting new files separately.
To create a patch:
- Select the item or items you wish to create a patch for.
From the pop-up menu, select "Team>Create Patch...".
- Select "Save In File System", "Browse" to select a target file and click the "Next" button.
- Select "Recurse into sub-folders", unselect "Include new files in patch", select the Diff output format of "Unified" and Click the "Finish" button.
You have created a patch!