Setting up FOP Trunk with IntelliJ IDEA

Checking out

  • Start IntelliJ IDEA and select 'Check out from Version Control'

http://people.apache.org/~adelmelle/fop-intellij-setup/1_checkout.png

  • 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.

http://people.apache.org/~adelmelle/fop-intellij-setup/2b_newrepo_url.png

  • Select the 'trunk' directory, and choose 'Checkout'.

http://people.apache.org/~adelmelle/fop-intellij-setup/2c_trunk_checkout.png

  • Choose the destination directory ...

http://people.apache.org/~adelmelle/fop-intellij-setup/3_destination.png

  • ... and change some other options, if needed. For a standard setup, everything can be left unchanged here.

http://people.apache.org/~adelmelle/fop-intellij-setup/3a_destination_opts.png

  • Choose the Subversion format for the working copy, if applicable (depends on which SVN versions you have installed).

http://people.apache.org/~adelmelle/fop-intellij-setup/3b_svn_format.png

  • Just wait while all files are checked out. Clicking on the status bar at the bottom of the screen will show some details.

http://people.apache.org/~adelmelle/fop-intellij-setup/3c_checking_out.png

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'

http://people.apache.org/~adelmelle/fop-intellij-setup/4a_from_sources.png

  • Set project name and location on the filesystem

http://people.apache.org/~adelmelle/fop-intellij-setup/4b_name_location.png

  • 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.

http://people.apache.org/~adelmelle/fop-intellij-setup/4c_source_roots.png

  • 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.

http://people.apache.org/~adelmelle/fop-intellij-setup/4d_libraries.png

  • Confirm the module structure, ...

http://people.apache.org/~adelmelle/fop-intellij-setup/4e_module_structure.png

  • ... and click 'Finish'

http://people.apache.org/~adelmelle/fop-intellij-setup/4f_finish.png

  • Wait while IntelliJ generates the project.

http://people.apache.org/~adelmelle/fop-intellij-setup/4g_creating_project.png

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).

http://people.apache.org/~adelmelle/fop-intellij-setup/5b_target_compile.png

  • 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.

http://people.apache.org/~adelmelle/fop-intellij-setup/6a_jdk_compatibility.png

  • 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...

http://people.apache.org/~adelmelle/fop-intellij-setup/6b_add_dependencies.png

  • ... and confirm

http://people.apache.org/~adelmelle/fop-intellij-setup/6d_libs_added.png

Note: Upon clicking OK, if the JDK version has changed, IntelliJ will ask you to close and re-open the project now.

Compiling

  • 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'.
  • No labels