从命令行生成 Ant 脚本

Ant 脚本通常是使用“插件开发环境”(PDE)生成的,但是也可以手工或者从其它脚本来生成 Ant 脚本。 
实际上 PDE 公开 Ant 任务以生成各种构建脚本。构建脚本生成设施驻留在下列任务中。还列示了每个任务的自变量。

示例

<eclipse.fetch elements="plugin@org.eclipse.core.boot"
		install="c:\toBuild"
		directory="directory.txt"
		scriptname="fetch.xml"/>
		
<eclipse.buildScript elements="plugin@org.eclipse.core.boot" 
		install="c:\toBuild"/>

目录文件格式

目录文件用来指示插件和功能部件所在的位置,并指示应当取装哪个版本。它是一个 Java 属性文件,其行格式为“type@id=version, repositoryLocation, password”。

目录文件的示例

feature@org.eclipse.jdt.source=v20030114, :pserver:anonymous@dev.eclipse.org:/home/eclipse,
plugin@org.eclipse.core.boot=v20021215a, :pserver:anonymous@dev.eclipse.org:/home/eclipse,
plugin@org.eclipse.core.resources=v20030114, :pserver:anonymous@dev.eclipse.org:/home/eclipse,
fragment@org.eclipse.core.resources.win32=v20020911, :pserver:anonymous@dev.eclipse.org:/home/eclipse,

使用目标

仅当 Eclipse 正在运行时先前描述的任务才能工作。在使用 Eclipse 任务执行 Ant 脚本的特定方案中,必须使用“Eclipse Ant 运行程序”应用程序来运行脚本。此特定情况的命令行为如下所示:
  java -cp startup.jar org.eclipse.core.launcher.Main -application org.eclipse.ant.core.antRunner -buildfile build.xml

注意,出现在应用程序后面的参数就是传递给 Ant 的参数。

 
Copyright IBM Corporation and others 2000, 2003