Back to FOPProjectPages.
IDE Setup Guide
This page tells you how to setup FOP for development in an IDE.
Eclipse
Initial project setup
Create a new java project, using File->New...->Project
Setup the project for CVS by using Team->Share Project... from the context menu (Eclipse 2.1)
Setup CVS Repositories
- Open the "CVS Repository Exploring Perspective"
- Create a new "Repository Location" (via context menu)
Anonymous access
- Host: cvs.apache.org
- Path: /home/cvspublic
- User: anonymous
Password: leave empty</>
- Connection type: pserver
Committer access
- Host: cvs.apache.org
- Path: /home/cvs
User: <uid>
Password: <pwd>
- Connection type: ext
User: <uid> Password: <pwd>
Expand the newly created repository location, open "HEAD", right-click on "xml-fop" and select "Check Out As...". That's basically it.
In order to enjoy the automatic compilation feature of Eclipse, you have to define source directories and add libraries in the project preferences ("source" and "libraries" tabs). Because FOP uses Java code generated from XML in the src/codegen directory, you'll still have to run the "codegen" target in the buildfile. The generated code is written to the build/gensrc directory. Add this before running the Libraries: Download and add JIMI, JAI, JEuclid and JUnit jars as external libraries or, alternatively, set an exclude path for the files which depend on Jimi, JAI, JEuclid and, for JDK 1.3, on JCE
Due to the current directory layout, setting FOP in Eclipse is a headache, you'll have to use exclude pathes because src/org and src/java-1.4/org overlap.
http://cvs.apache.org/~jeremias/eclipse-setup/CVSRepository.png http://cvs.apache.org/~jeremias/eclipse-setup/ConfigureBranches.png http://cvs.apache.org/~jeremias/eclipse-setup/ConfigureBranchesDialog.png http://cvs.apache.org/~jeremias/eclipse-setup/RememberedBranches.png
See the setup in the "work on HEAD" section, however, you have carefully set exclusion masks for You have to run an external Ant with both the targets of gensrc and prepare-compile, and clean out some of the superfluous generated files which Eclipse marks as conflicting.
The following setup is required for smooth work on the project, both for committers and users provifing patches. Choose Windows->Preferences. Java -> Code Generation, "Code and Comments" tab Code -> New Java Files: Press Edit and Copy&Paste from an source file the comment with the license. Look for dollar signs in the RCS "$Id: $" tag: replace them with two dollar signs, also kill the content behind the "Id:". Comments -> Types: Press Edit, kill the old content and add a line with "$(todo) add Javadoc". Add an appropriate "@autor" tag if you wish. Further ideas about customizations are welcome. Java -> Code Generation, "Names" tab: no prefixes or suffixes. Java -> Code Formatter, "Style" tab: you must uncheck the third option ("Insert tabs for indentation, not spaces"), we dont accept tabs in our Java source files. Also, the number of spaces representing an indentation level is 4. Uncheck the "Compact assignment" and "insert space after a cast" options too. Java -> Code Formatter, "New Lines" tab: uncheck the first, second and forth options ("Insert a blank line before an opening brace": we don't want this, "Insert new lines in control statements": we don't want this either, "Insert new line between 'else if': not our style). It is recommended to leave the third option ("Clear all blank lines") unchecked. Java -> Appearance -> Members sort order: this is only relevant if you intent to use the "Sort Members" functionality. We use the default order (Types, Static initializers, Static Fields, Static Methods, Initializers, Fields, Constructors, Methods) Java -> Organize Imports: We use the default order (java, javax, org, com). Inquiries for additions are welcome. Java -> Task tags: we use a TODO with normal priority (default), and occasionally a FIXME with a high priority (you have to add this if you want to see them in the task list)
Seems to be working now.
Download the Eclipse Checkstyle plug-in from http://sourceforge.net/projects/eclipse-cs/ . After installing the plug-in go to the Preferences dialog and to the Checkstyle section. Import the checkstyle config file from FOP's root directory. Adjust the path of the checkstyle.header.file entry. Tip: Set a file filter (".*/gensrc/.*") in the Checkstyle section of the project's Properties page. This avoids a lot of unavoidable style violations due to code generation.
PMD is similar to CheckStyle. It allows more powerful rules but configuring them is more difficult. It also comes with a nifty copy'n'paste detector. Get the PMD plugin from http://pmd.sf.net
Details of JBuilder setup to come.
Download jbCheckstyle, an Open Tool for JBuilder that provides integration of JBuilder and Checkstyle, from: http://jbcheckstyle.sourceforge.net/jbcheckstyle. After unzipping the contents, the README.html file contains complete instructions for installation and configuration. Be sure to adjust the path of the checkstyle.header.file entry, and use forward slashes for directory delimiters (even if you are running on a Windows platform). Failure to correctly configure this will cause jbCheckstyle to not provide any output.
You need a SSH executable for committer access. On Windows, there is Putty/plink (add link) and Cygwin SSH (get the setup.exe from http://www.cygwin.com). On Windows, you'll probably have to change the path to the SSH in the Preferences dialog under Team/CVS/Ext Connection Method:
As an alternative you can set up your SSH client to provide a tunnel as described here: http://jakarta.apache.org/site/cvsonwin32.html. This is usually a bit faster because the connection doesn't have to be built up each time you access CVS. It's just a matter of opening another channel over an open connection. In this case use the following setup: Work on HEAD
Download the project files
Setup source directories and libraries
codegen target outside Eclipse. When adding, you will have the opportunity to create a new directory. Create this directory. After running codegen, Refresh the directory in the Navigator view.
(TODO: add list). Work on the Maintenance Branch
Download the project files
Setup source directories and libraries
General setup
Preferences
Ant support
Checkstyle support
PMD support
JBuilder
Checkstyle setup (for JBuilder)