This page contains instructions on obtaining and compiling the Aduna AutoFocus source code.
Requirements
In order to checkout and build AutoFocus, you first need to install the following tools:
- Java: minimally 5.x, 6.x recommended
- SVN
- Maven 2
See Development tools for more information on these tools.
Source code - development
The latest AutoFocus development code can be found at http://repo.aduna-software.org/svn/info.aduna/autofocus/trunk/. Use https instead when you have commit access.
This directory contains a hierarchy of Maven modules that comprise the AutoFocus- and AutoFocus Server-specific modules. The easiest way to get the AutoFocus code is therefore by simply checking out this entire directory using SVN. This will give you more code than necessary but this should not pose any problems.
Depending on what parts of AutoFocus you want to edit, you may also want to checkout the following sibling trunks:
Source code - released versions
Source code of released versions can be found here:
Compiling AutoFocus
 | Aduna/OpenRDF parent poms
Please read the [Bootstrap instructions] for obtaining Aduna parent pom files. |
You can compile all Maven modules by executing the following command in the autofocus/trunk directory:
For those of you unfamiliar with Maven, this will do the following: Maven will loop over all modules in order of dependency, compile all code it finds in it, run all unit tests that come with the module, create a jar file of the compiled code in the module's target directory and copy that jar file to your local Maven repository, usually located in <userhome>/.m2/repository/.
During this process, any third party jar files required by any of these modules are automatically downloaded from the central Maven repository and stored in your local repository. Furthermore, the first time you use a particular Maven task, it will download any missing components and add those to your local repository as well.
This process should complete with a BUILD SUCCESSFUL message.
When you have modified the code in the trunk of another project, e.g. the Cluster Map project, then first do an install in that trunk, followed by an install in the AutoFocus trunk.
Creating a Distribution
A self-contained AutoFocus distribution (excluding the JRE, native launcher and installer) can be created by descending into the autofocus/trunk/desktop directory and invoking the following command:
This will create a directory called "target" in that directory, containing a subdirectory called "aduna-autofocus-desktop-<version>". The latter directory will contain all required jar files, startup scripts and documentation. Also, .zip and .tar.gz archives of this directory can afterwards be found in the target directory.
Working with Eclipse
At Aduna we primarily use Eclipse for coding. If you want to be able to compile and run AutoFocus from within Eclipse, you need to set the M2_REPO classpath variable in Eclipse. It should point to your Maven repository, usually located in <userhome>/.m2/repository. Changing this variable can be done from within Eclipse (go to Window -> Preferences -> Java -> Build Path -> Classpath Variables) or on the command line:
Now invoke the following command in the trunk directory:
This command will create Eclipse project files in every leaf in the Maven module tree; every leaf module becomes a separate Eclipse project (only leaf modules contain source code, non-leaf modules only aggregate modules). It automatically sets all third party dependencies that these modules have by adding the required jar files from your Maven repository to the Eclipse project's classpath, using the M2_REPO variable.
Furthermore, dependencies between Maven modules are mapped to dependencies between their Eclipse projects, rather than dependencies on the resulting jar files in the Maven repository. The latter is important as it allows you to edit in any Eclipse project used by AutoFocus and immediately run AutoFocus from within Eclipse, without requiring you to do a "mvn install" on the edited project first.
You can open all these Eclipse projects at once by choosing File -> Import -> Existing Projects into Workspace.
Perform the following steps to run AutoFocus from within Eclipse:
- Locate the info.aduna.autofocus.AutoFocus class in the aduna-autofocus-desktop project.
- Choose "Run" -> "Open Run Dialog" in the menu.
- Select the Arguments tab and enter "-Xmx300M" (without the quotes) in the VM arguments field.
- Select the Classpath tab, select the "aduna-autofocus-desktop" node in the tree, click on the Edit button and check the "Only include exported entries" checkbox.
Now, press "Run" to launch AutoFocus. Note that your run configuration is saved and can be re-run again by choosing "AutoFocus" from the Run menu.
Besides Eclipse support, Maven supports creation of project files for other IDEs such as Netbeans and IntelliJ IDEA out-of-the-box. We currently have no experience with setting up projects for these IDEs but assume that the process will be very similar (probably just replacing "eclipse:eclipse" with something IDE-specific).
Creating Installers
These is a separate module for creating AutoFocus installers. Currently, only Windows (.exe) installers are supported, more platforms may follow in the future. This project requires that you also have Ant installed (Ant 1.6.5 has been used when developing this script). Steps to perform:
- Make an AutoFocus distribution using the assembly:assembly target as described above.
- Go to the installer directory and create a directory called "input".
- Place the contents of the assembly in this directory, i.e. it should subdirs such as bin, lib, etc., containing all AutoFocus-related files that you want to include.
- Now invoke "ant" in the installer dir.
The Ant script will now verify that the input directory exists, contains reasonable contents and asks you for a version number. Upon completion the script will have created an application launcher (AutoFocus.exe) and produce an installer that can install the application files, a launcher (AutoFocus.exe), an uninstaller, a private JRE and application shortcuts. You can find the generated installer in installer/output.