Java 从源代码构建Freemarker
我在大学里从事一个开源软件的安全项目。我试图从源代码构建freemarker,但遇到了一些问题。我在网上找到的所有信息都表明,在根目录中简单地运行“ant”应该可以构建项目。唯一的要求是您已经安装了AntV1.7.0,我就是这么做的 当我进入根目录并键入“ant”时,我得到以下输出:Java 从源代码构建Freemarker,java,security,ant,build-process,freemarker,Java,Security,Ant,Build Process,Freemarker,我在大学里从事一个开源软件的安全项目。我试图从源代码构建freemarker,但遇到了一些问题。我在网上找到的所有信息都表明,在根目录中简单地运行“ant”应该可以构建项目。唯一的要求是您已经安装了AntV1.7.0,我就是这么做的 当我进入根目录并键入“ant”时,我得到以下输出: Buildfile: build.xml init: _autoget-deps: update-deps: [echo] Getting dependencies... [echo] -
Buildfile: build.xml
init:
_autoget-deps:
update-deps:
[echo] Getting dependencies...
[echo] -------------------------------------------------------
BUILD FAILED
/media/osr/runs/java/freemarker/freemarker/trunk/freemarker/build.xml:64: The following error occurred while executing this line:
/media/osr/runs/java/freemarker/freemarker/trunk/freemarker/build.xml:567: The following error occurred while executing this line:
/media/osr/runs/java/freemarker/freemarker/trunk/freemarker/build.xml:575: 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.
This appears to be an antlib declaration.
Action: Check that the implementing library exists in one of:
-/usr/share/ant/lib
-/home/murrayj/.ant/lib
-a directory added on the command line with the -lib argument
Total time: 0 seconds
Buildfile:build.xml
初始化:
_自动获取deps:
更新deps:
[echo]正在获取依赖项。。。
[回声]-------------------------------------------------------
构建失败
/media/osr/runs/java/freemarker/freemarker/trunk/freemarker/build.xml:64:执行此行时发生以下错误:
/media/osr/runs/java/freemarker/freemarker/trunk/freemarker/build.xml:567:执行此行时发生以下错误:
/media/osr/runs/java/freemarker/freemarker/trunk/freemarker/build.xml:575:问题:无法创建任务或类型antlib:org.apache.ivy.ant:settings
原因:名称未定义。
措施:检查拼写。
操作:检查是否已声明任何自定义任务/类型。
措施:检查是否发生了任何/声明。
这似乎是一个antlib声明。
操作:检查实现库是否存在于以下之一中:
-/usr/share/ant/lib
-/home/murrayj/.ant/lib
-使用-lib参数在命令行上添加的目录
总时间:0秒
build.xml没有默认目标。试试这个
ant compile
编辑:更改的目标build.xml没有默认目标。试试这个
ant compile
编辑:更改目标您还需要ApacheIvy。我们已经改变了构建过程一段时间了;它现在使用Ivy而不是手动依赖关系管理。您还需要ApacheIvy。我们已经改变了构建过程一段时间了;它现在使用Ivy而不是手动依赖关系管理。安装Ivy后,运行
ant编译
工作很好
谢谢大家! 安装ivy后,运行
ant编译
工作很好
谢谢大家! 在Ubuntu/Debian上安装Ivy还需要手动将其添加到 蚂蚁类路径 虽然这可能不是最干净的方法[1]
sudo ln -s /usr/share/java/ivy.jar /usr/share/ant/lib/ivy.jar
[1] 在Ubuntu/Debian上安装Ivy还需要手动将其添加到 蚂蚁类路径 虽然这可能不是最干净的方法[1]
sudo ln -s /usr/share/java/ivy.jar /usr/share/ant/lib/ivy.jar
[1] 我尝试运行“ant all”,但生成失败,错误指出项目中不存在目标“all”。@johnmurray,我已更改目标,请尝试一次。我尝试运行“ant all”,但生成失败,错误指出项目中不存在目标“all”。@johnmurray,我已更改目标,请试一试。我可以通过下载常春藤JAR文件并将其添加到ant/lib目录来添加常春藤吗?我这样做了,它解决了问题。我可以通过下载常春藤JAR文件并将其添加到ant/lib目录来添加常春藤吗?我这样做了,它解决了问题