javaantfreemarkerivy

How to build freemarker from sources?


I have a project git clone --depth 1 --branch v2.3.30 https://github.com/apache/freemarker.git and want to build it from sources. For that I issue the command:

ant jar

with following output:

└─$ ant -version                                                                                                                                         1 ⨯
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Apache Ant(TM) version 1.10.9 compiled on December 25 1969
                                                                                                                                                             
┌──(katya12㉿kali)-[/home/…/prostor/offline/ito-kpo-mka/freemarker]
└─$ ant jar     
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Buildfile: /home/katya/work/prostor/offline/ito-kpo-mka/freemarker/build.xml
     [copy] Copying 1 file to /home/katya/work/prostor/offline/ito-kpo-mka/freemarker/build
   [delete] Deleting: /home/katya/work/prostor/offline/ito-kpo-mka/freemarker/build/version.properties.tmp

_autoget-deps:
     [copy] Copying 1 file to /home/katya/work/prostor/offline/ito-kpo-mka/freemarker/build
   [delete] Deleting: /home/katya/work/prostor/offline/ito-kpo-mka/freemarker/build/version.properties.tmp

_autoget-deps-condition-workaround:
     [copy] Copying 1 file to /home/katya/work/prostor/offline/ito-kpo-mka/freemarker/build
   [delete] Deleting: /home/katya/work/prostor/offline/ito-kpo-mka/freemarker/build/version.properties.tmp

update-deps:
     [echo] Getting dependencies...
     [echo] -------------------------------------------------------

BUILD FAILED
/home/katya/work/prostor/offline/ito-kpo-mka/freemarker/build.xml:968: The following error occurred while executing this line:
/home/katya/work/prostor/offline/ito-kpo-mka/freemarker/build.xml:977: The following error occurred while executing this line:
/home/katya/work/prostor/offline/ito-kpo-mka/freemarker/build.xml:985: Problem: failed to create task or type antlib:org.apache.ivy.ant:settings
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet

This appears to be an antlib declaration. 
Action: Check that the implementing library exists in one of:
        -/usr/share/ant/lib
        -/home/katya12/.ant/lib
        -a directory added on the command line with the -lib argument


Total time: 0 seconds

I have no idea what does it mean. Could you tell me? Is it possible to build sources with Ant or Ivy somehow? Thank you!


Solution

  • Follow the guide on the GitHub page

    Building FreeMarker

    If you haven't yet, download the source release, or checkout FreeMarker from the source code repository. See repository locations here: https://freemarker.apache.org/sourcecode.html

    You need JDK 8 (not JDK 9!), Apache Ant (tested with 1.9.6) and Ivy (tested with 2.5.0) to be installed. To install Ivy (but be sure it's not already installed), issue ant download-ivy; it will copy Ivy under ~/.ant/lib. (Alternatively, you can copy ivy-.jar into the Ant home lib subfolder manually.)

    It's recommended to copy build.properties.sample into build.properties, and edit its content to fit your system. (Although basic jar building should succeeds without the build.properties file too.)

    To build freemarker.jar, just issue ant in the project root directory, and it should download all dependencies automatically and build freemarker.jar. (Depencies will be cached into the .ivy/cache subdirectory of the project.)

    To test your build, issue ant test.

    To generate documentation, issue ant javadoc and ant manualOffline.