Setting up FOP Trunk with IntelliJ IDEA
- Start IntelliJ IDEA and select 'Check out from Version Control'
- Create the repository root if it does not exist yet. Setting the root to the 'fop' directory, rather than 'fop/trunk', will allow to reuse the same repository root to check out branches.
- Select the 'trunk' directory, and choose 'Checkout'.
- Choose the destination directory ...
- ... and change some other options, if needed. For a standard setup, everything can be left unchanged here.
- Choose the Subversion format for the working copy, if applicable (depends on which SVN versions you have installed).
- Just wait while all files are checked out. Clicking on the status bar at the bottom of the screen will show some details.
Creating the project
Once everything has been checked out, IntelliJ will ask you whether you want to create a new project from it. Choose 'Yes' and...
- Select 'Create Java project from existing sources'
- Set project name and location on the filesystem
- When asked to select the source roots, for a basic setup, it suffices to leave only the 'src/java' entry checked. For developers and more adventurous contributors, it may make sense to generate modules for the other locations as well.
- For the libraries, it is not necessary to include the 'build' set. Those are only referenced by the Ant build file, and not necessary to be able to compile from within IntelliJ. For the 'lib' set, we allow to generate a module library set for convenience. Nothing is added for the rest at this point. Further on, we will need to add some dependencies, but the 'lib' set is enough to get us started.
- Confirm the module structure, ...
- ... and click 'Finish'
- Wait while IntelliJ generates the project.
Initial project setup
Once the project has been generated, there's some smaller tasks to perform before IntelliJ can compile the org.apache.fop package.
- Use the Ant Build plugin to load FOP's build.xml, and run the 'compile' target. This target will create and compile classes for which the code is generated at build time (font- and event-related classes).
When the 'compile' target has been run, we have everything we need to add two necessary dependencies, but there's one other important thing to take care of. Choose 'File->Project Structure'.
- At the time of writing, FOP still has to remain Java 1.4 compatible, so you will want to modify that now.
- Selecting 'Module' will allow to add two missing dependencies: the classes generated by the Ant build (under build/classes), and Apache Ant itself for the org.apache.fop.tools package.
- Create the dependencies...
- ... and confirm
Note: Upon clicking OK, if the JDK version has changed, IntelliJ will ask you to close and re-open the project now.
If the above produced no errors/irregularities, then it should now be possible to compile the org.apache.fop package, by selecting it and choosing 'Build->Compile org.apache.fop'.