如何从源代码构建 freemarker?

How to build freemarker from sources?

我有一个项目 git clone --depth 1 --branch v2.3.30 https://github.com/apache/freemarker.git 并且想从源代码构建它。为此,我发出一个 commnd

ant jar

具有以下输出

└─$ 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

我不知道这是什么意思。你能不能告诉我?是否有可能以某种方式使用 ANT 或 IVY 构建源代码?谢谢!

按照 GitHub page

上的指南进行操作

构建 FreeMarker

如果您还没有,请下载源代码版本,或从源代码存储库中签出 FreeMarker。在此处查看存储库位置:https://freemarker.apache.org/sourcecode.html

您需要安装 JDK 8(不是 JDK 9!)、Apache Ant(使用 1.9.6 测试)和 Ivy(使用 2.5.0 测试)。要安装 Ivy(但要确保它尚未安装),请发出 ant download-ivy;它会在 ~/.ant/lib 下复制 Ivy。 (或者,您可以手动将 ivy-.jar 复制到 Ant home lib 子文件夹中。)

建议将 build.properties.sample 复制到 build.properties,并编辑其内容以适合您的系统。 (尽管基本的 jar 构建在没有 build.properties 文件的情况下也应该成功。)

要构建freemarker.jar,只需在项目根目录下运行ant,它应该会自动下载所有依赖项并构建freemarker.jar。 (依赖项将缓存到项目的 .ivy/cache 子目录中。)

要测试您的构建,请发出 ant test。

要生成文档,发布 ant javadoc 和 ant manualOffline。