简体   繁体   English

使用.launch文件运行ANT目标

[英]Running ANT targets using .launch file

In one of my legacy project ant target is invoved from *.launch file. 在我的遗留项目之一中,ant目标是从* .launch文件中调用的。 This file contains <launchConfiguration> tag and one of the attribute name "type" is ant class org.eclipse.ant.ANTLaunchConfigurationType, different parameter are set using this tag. 该文件包含<launchConfiguration>标记,属性名称“类型”之一是ant类org.eclipse.ant.ANTLaunchConfigurationType,使用此标记设置了不同的参数。 When this launch file is executed in eclipse, one of the ANT target is executed specified in launchConfiguration tag. 当在eclipse中执行此启动文件时,将执行launchConfiguration标记中指定的ANT目标之一。

I am not able to find any information around this functionality of ANT. 我找不到有关ANT的此功能的任何信息。 Only relevant thread found is, which is unanswered 仅找到相关的线程,无法回答

Running eclipse ant targets from an external command 从外部命令运行eclipse ant目标

I am not able to understand how launch files are created and how to set parameter to launchConfiguration tag. 我无法理解如何创建启动文件以及如何将参数设置为launchConfiguration标记。

The .launch files are created by Eclipse for every Run Configuration you want to be saved: Eclipse为您要保存的每个运行配置创建.launch文件:

  1. Open Eclipse. 打开Eclipse。
  2. Select a build.xml file. 选择一个build.xml文件。
  3. Through the context menu, execute Run as/Ant build... . 通过上下文菜单执行Run as/Ant build... A dialog appears. 出现一个对话框。
  4. If you want to pass parameters to the Ant script, you have to fulfil the Arguments area (in the Main tab) like this: 如果要将参数传递给Ant脚本,则必须完成“ Arguments区域(在“ Main选项卡中),如下所示:
-Darg1=value1
   -Darg2=value2
   ...
  1. Then, go to the Common Tab and focus on the Share file field: With the Browse button, select your project. 然后,转到“ Common选项卡,然后将焦点放在“ Share file字段上:使用“ Browse按钮,选择您的项目。 This will create the .launch file into your project, and let it available for further executions. 这将在您的项目中创建.launch文件,并使其可用于进一步执行。 (You should rename it). (您应该重命名)。
  2. Execute Run . 执行Run
  3. You can edit the .launch configuration in menu Run>External tools>External tools configuration . 您可以在菜单Run>External tools>External tools configuration编辑.launch Run>External tools>External tools configuration

Note: Within the Run Configuration, you'd better spend some minutes reading all the parameters available in all the tabs. 注意:在“运行配置”中,您最好花一些时间阅读所有选项卡中的所有可用参数。 For example, in the Build tab, you can set if you want a project to be build before your script is executed (If not, unchecking the checkbox may save you a lot of time). 例如,在“ Build选项卡中,可以设置是否要在执行脚本之前构建项目(如果不执行此操作,则取消选中该复选框可以节省大量时间)。 Or in the Refresh tab, you can select which project directories you want to be refreshed after the script is executed, etc. 或者在“ Refresh选项卡中,可以选择要在执行脚本后刷新的项目目录,等等。

Launch configurations for Ant Builds are created and managed using the 'Run > External Tools > External Tools Configurations...' dialog. 使用“运行>外部工具>外部工具配置...”对话框创建和管理Ant Build的启动配置。

You can import existing .launch files using 'File > Import... > Run/Debug > Launch Configurations' 您可以使用“文件>导入...>运行/调试>启动配置”导入现有的.launch文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM