How to build Freeplane

From Freeplane - free mind mapping and knowledge management software
Revision as of 15:33, 4 November 2011 by Jokro (talk | contribs) (Build files)

First steps

To build Freeplane, you can:

  1. Get the source code in one of the following ways:
    • Download the freeplane_src archive from http://sourceforge.net/projects/freeplane/files/ (NOT the freeplane_srcpure archive -- this does not contain the external libraries required for the build.)
    • Check out the latest source code from the bzr repository (for bzr repository URLs, see below). Do one of the following, depending on whether you prefer a small checkout-directory size, or a repository having full history:
      • bzr checkout --lightweight URL freeplane [no history, directory size ~ 30MB] OR
      • bzr clone URL freeplane [full history, directory size ~ 150MB]
    • Update to the latest source code in the bzr repository. From within the freeplane bzr directory:
      • bzr update
  2. Build the source code, by typing the following commands:
    • cd freeplane_framework/ant
    • ant [Without parameters, this defaults to 'dist' to build all targets. See the Using ant section below for more details.]

After the code finishes building, target files can be found inside the freeplane_framework/dist directory.

Bazaar branches:

  • Current development: bzr://freeplane.bzr.sourceforge.net/bzrroot/freeplane/freeplane_program/trunk
  • Maintenance branch for 1.1 releases: bzr://freeplane.bzr.sourceforge.net/bzrroot/freeplane/freeplane_program/release_branches/1_0_x

Further information on the Bazaar repository used by Freeplane is available on the Bazaar howto wiki page.

Using ant

Building Freeplane requires that you have ant installed on your computer. From the ant directory you can run ant TARGET where TARGET is one of the following:

  • build (create directory with binaries in freeplane/freeplane_framework/build)
  • binzip (create binary zipfile in freeplane/freeplane_framework/dist)
  • srczip (create source zipfile in freeplane/freeplane_framework/dist)
  • installer (create windows installer in freeplane/freeplane_framework/dist)
  • portableinstaller (create portable-windows installer in freeplane/freeplane_framework/dist)
  • dmg4mac (create OS X DMG file in freeplane/freeplane_framework/dist)

Specifying no target will end up building all of the above targets.

If you wish to specify a destination build directory, you can do so by adding the build property as a commandline argument to ant:

  • ant -Dbuild=<destination directory> build .


If you change some translation (.properties) files you may get an error like this:

check-translation:
[check-translation]
D:\Freeplane121\freeplane\viewer-resources\translations\Resources_en.properties requires formatting - content changed
BUILD FAILED
D:\Freeplane121\freeplane_framework\ant\build.xml:56: The following error occurred while executing this line:
D:\Freeplane121\freeplane_framework\ant\build.xml:37: The following error occurred while executing this line:
D:\Freeplane121\freeplane\ant\build.xml:50: The following error occurred while executing this line:
D:\Freeplane121\freeplane\ant\build.xml:191: 1 files require proper formatting - run format-translation to fix

In this case you have to format the properties-Files.

This is done with

ant format-translation

Ant options for building freeplane for upload on Source Forge servers

Please consider following settings

For building test versions:

ant -Dminor=XX 
  • -Dminor=XX adds the testversion number to the file names for creating the test version.

For building stable versions:

ant -Dskip_bugreport=true
  • -Dskip_bugreport=true excludes plugin bugreport from build.

Use option -Dskip_bugreport=true to exclude the bugreport plugin compiling the stable versions (not the testversions, alpha, beta and rc but only the final stable versions like the coming Freeplane 1.1.0).

  • Similar -Dskip_PLUGIN options are available for skipping the other plugins like -Dskip_script=true but they are usually not needed.

Build files

The build is described in build.xml files:

 $ grep -H /freeplane.*jar freeplane/ant/ant.properties; \
   egrep '(<jar )|property.*name="free.*jar"' */ant/build.xml
 freeplane/ant/ant.properties:  freeplaneviewer.jar = ${freeplane.dist.lib}/freeplaneviewer.jar
 freeplane/ant/ant.properties:  freeplaneeditor.jar = ${freeplane.dist.lib}/freeplaneeditor.jar
 freeplane/ant/ant.properties:  freeplaneosgi.jar = ${freeplane.dist.lib}/freeplaneosgi.jar
 freeplane/ant/ant.properties:  freeplanemac.jar = ${freeplane.ext.lib}/freeplanemac.jar
 freeplane/ant/build.xml:  <property name="freeplaneant.jar" value="${workspace}/freeplane_framework/ant/lib/freeplaneant.jar" />
 freeplane/ant/build.xml:  <property name="freeplaneplugin.jar" value="${dist.osgi.dir}/org.freeplane.core.jar" />
 freeplane/ant/build.xml:  <jar jarfile="${freeplaneviewer.jar}">
 freeplane/ant/build.xml:  <jar jarfile="${freeplaneeditor.jar}" manifest="${manifest}">
 freeplane/ant/build.xml:  <jar jarfile="${freeplaneosgi.jar}">
 freeplane/ant/build.xml:  <jar jarfile="${freeplaneplugin.jar}">
 freeplane_mac/ant/build.xml:  <jar jarfile="${workspace}/freeplane/lib/freeplanemac.jar" update="false" >
 freeplane_plugin_bugreport/ant/build.xml:  <property name="freeplaneplugin.jar" value="${dist}/org.freeplane.plugin.bugreport.jar"/>
 freeplane_plugin_bugreport/ant/build.xml:  <jar jarfile="${freeplaneplugin.jar}">
 freeplane_plugin_help/ant/build.xml:  <property name="freeplaneplugin.jar" value="${dist}/org.freeplane.plugin.help.jar"/>
 freeplane_plugin_help/ant/build.xml:  <jar jarfile="${freeplaneplugin.jar}">
 freeplane_plugin_latex/ant/build.xml:  <property name="freeplaneplugin.jar" value="${dist}/org.freeplane.plugin.latex.jar"/>
 freeplane_plugin_latex/ant/build.xml:  <jar jarfile="${freeplaneplugin.jar}">
 freeplane_plugin_script/ant/build.xml:  <property name="freeplaneplugin.jar" value="${dist}/org.freeplane.plugin.script.jar"/>
 freeplane_plugin_script/ant/build.xml:  <jar jarfile="${freeplaneplugin.jar}">
 freeplane_plugin_svg/ant/build.xml:  <property name="freeplaneplugin.jar" value="${dist}/org.freeplane.plugin.svg.jar"/>
 freeplane_plugin_svg/ant/build.xml:  <jar jarfile="${freeplaneplugin.jar}">

The additional project freeplane_framework, have a higher level scope; the latter is the centralized entry into the build system to build the whole application:

 $ cd freeplane_framework/ant
 $ ant build dist