Back to FOPProjectPages.


IDE Setup Guide

This page tells you how to setup FOP for development in an IDE.


Eclipse (3.x)

For the following to work you'll need the Subclipse plug-in which you can get through the following update site: http://subclipse.tigris.org/update

Importing an existing FOP checkout into Eclipse

Checking out inside Eclipse

Setup SVN Repository location

Anonymous access

http://people.apache.org/~jeremias/eclipse-setup/new-svn-repo.png

Committer access

Work on the Trunk

Download the project files

http://people.apache.org/~jeremias/eclipse-setup/svn-checkout-as.png

Setup source directories and libraries

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. See notes below on adding source directories before you do this. Here is how you do it:

Open the Java Build Path of the Project

Add the following directories as source directories:

Libraries:

Note: If you haven't followed the above instructions, it might happen that eclipe will not set the project as a Java Project. You might want to try this hack:

        <buildSpec>
                <buildCommand>
                        <name>org.eclipse.jdt.core.javabuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
        </buildSpec>
        <natures>
                <nature>org.eclipse.jdt.core.javanature</nature>
        </natures>


Work on the Maintenance Branch

Due to the current directory layout, setting FOP in Eclipse is a headache, you'll have to use exclude paths because src/org and src/java-1.4/org overlap.

Download the project files

Setup source directories and libraries

See the setup in the "Work on the Trunk" section, however, you have to 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.


General setup

Preferences

The following setup is required for smooth work on the project, both for committers and users providing patches. Choose Windows->Preferences.

Ant support

Seems to be working now.

Checkstyle support

Download the Eclipse Checkstyle plug-in.

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 support

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.


JBuilder

Details of JBuilder setup to come.

Checkstyle setup (for JBuilder)

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.

NetBeans (4.1)

Work on the Trunk

NetBeans 4.1 or later is recommended as this is the first NetBeans version supporting multiple source root directories. This allows to work with the unchanged FOP directory layout.

For the following to work you'll need the Subversion profile installed in NetBeans which you can get through the following update site: http://vcsgeneric.netbeans.org/profiles/index.html.

Download the project files

Checkout the trunk from Subversion into an empty directory from now on referred to as $FOP_HOME. Download / install any additional libraries like JAI and/or Jimi. The simplest way is to put them into the $FOP_HOME/lib directory. One can also create a build-local.properties file in $FOP_HOME, define the property <property name="optional.lib.dir" value="<path to optional lib directory>"/> in that file, and put the non FOP supplied libraries in that directory. Now do a command line build of FOP using ant.

Setup the project in NetBeans

To import this into NetBeans following these steps:

http://people.apache.org/~manuel/fop/images/netbeans_step_1.gif

http://people.apache.org/~manuel/fop/images/netbeans_step_2.gif

http://people.apache.org/~manuel/fop/images/netbeans_step_3.gif

http://people.apache.org/~manuel/fop/images/netbeans_step_4.gif

Connect the project to Subversion

Open the Versioning Manager (Versioning / Versioning Manager) and click on Add.

http://people.apache.org/~manuel/fop/images/netbeans_step_5.gif

Checkstyle support

Download and install the NetBeans 4.0 Checkstyle plug-in. Under Tools/Options/Building/Checkstyle Settings set the Checkstyle Properties file location to the checkstyle.xml that comes with the SVN checkout of FOP.


Setup for NetBeans (6.5)

Netbeans 6.5 or later has built in support for SVN (Subversion). SVN allows you to work on the latest trunk version of Apache's FOP. See http://subversion.tigris.org/ for more information on SVN.

This tutorial assumes you are familiar with Netbeans, Apache's Ant and SVN. In order to set up the FOP in Netbeans 6.5, you will need the following installed:

* Apache Ant http://ant.apache.org/bindownload.cgi

* Netbeans 6.5 http://www.netbeans.org/downloads/

* Java Advanced Imaging Binary Builds https://jai.dev.java.net/binary-builds.html. For windows, download jai-1_1_2_01-lib-windows-i586.exe (this needs to be installed).

* Saxon (saxon9-dom.jar) http://saxon.sourceforge.net/

Check out the trunk

* Start Netbeans 6.5

* Click 'Versioning', 'Checkout'

http://www.aviationcontentmanagement.com/images/netbeans/checkout.png

* The check out dialog box will open. In the Repository URL put:https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk

http://www.aviationcontentmanagement.com/images/netbeans/checkout2.png

* Click 'Next'

* In the local Folder textbox, choose a location where you want the trunk version to be downloaded to. You will need to remember this location for when you create your Netbeans project.

http://www.aviationcontentmanagement.com/images/netbeans/checkout3.png

* The check out process may take several minutes. After checking out the trunk, you will need to do an Ant build.

Run an Ant build

* Do an Ant build of the trunk that you downloaded.

http://www.aviationcontentmanagement.com/images/netbeans/ant1.png

http://www.aviationcontentmanagement.com/images/netbeans/ant2.png

Creating the Project

* In Netbeans, click 'New Project'

* The New Project dialog box opens.

* In the Catagories, choose 'Java" and then choose "Java Project with Existing Sources' from the projects window.

* Click 'Next'

http://www.aviationcontentmanagement.com/images/netbeans/step1.png

* The 'Java Project with Existing Sources' dialog will open.

* In the Project Name textbox, give your project a name (e.g. Fop).

* Choose your Project Folder.

* Click 'Next'

http://www.aviationcontentmanagement.com/images/netbeans/step2.png

* Now you will need to add your Existing Sources. * Click the 'Add Folder'

http://www.aviationcontentmanagement.com/images/netbeans/step3.png

* Navigate to where you downloaded the trunk to. (e.g. c:\foptrunk2)

* Add the Folders: ( this assumes your downloaded version of Fop Trunk is c:\foptrunk2

- c:\foptrunk2\src\java

- c:\foptrunk2\build\gensrc

http://www.aviationcontentmanagement.com/images/netbeans/step4.png

* Click 'Next'

* The next step is the Includes and Excludes dialog.

* Give Netbeans a few minutes to load all the included files.

* Click 'Finished'

http://www.aviationcontentmanagement.com/images/netbeans/step5.png

* Now, netbeans will create the project. When Netbeans finishes, you will notice a number of resources missing:

http://www.aviationcontentmanagement.com/images/netbeans/step6.png

http://www.aviationcontentmanagement.com/images/netbeans/step7.png

* You will need to a number of dependencies for your project.

http://www.aviationcontentmanagement.com/images/netbeans/step8.png

* Jai (by default (windows) located in 'C:\jai-1_1_2_01\lib')

- jai_codec.jar

- jai_core.jar

- mlibwrapper_jai.jar

* Saxon

- saxon9-dom.jar (Download from http://saxon.sourceforge.net/ and place in the your \lib folder of the fop trunk e.g. c:\foptrunk2\lib)

http://www.aviationcontentmanagement.com/images/netbeans/saxon.png

* FOP

- avalon-framework-4.2.0.jar

- batik-all-1.7.jar

- commons-io-1.3.1.jar

- commons-logging-1.0.4.jar

- saxon9-dom.jar

- serializer-2.7.0.jar

- servlet-2.2.jar

- xalan-2.7.0.jar

- xercesImpl-2.7.1.jar

- xml-apis-1.3.04.jar

- xml-apis-ext-1.3.04.jar

- xmlgraphics-commons-1.4svn.jar

* Ant

- ant.jar (located in the ant director e.g. c:\ant\lib)

http://www.aviationcontentmanagement.com/images/netbeans/step8a.png

http://www.aviationcontentmanagement.com/images/netbeans/step8b.png

http://www.aviationcontentmanagement.com/images/netbeans/step9.png

* Netbeans will take a few minutes to import the resources.

* If all goes well, you will see:

http://www.aviationcontentmanagement.com/images/netbeans/finished.png

* That's it! Good Luck.

FOPIDESetupGuide (last edited 2009-09-20 23:52:09 by localhost)