简体   繁体   中英

Running ANT targets using .launch file

In one of my legacy project ant target is invoved from *.launch file. 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. When this launch file is executed in eclipse, one of the ANT target is executed specified in launchConfiguration tag.

I am not able to find any information around this functionality of ANT. Only relevant thread found is, which is unanswered

Running eclipse ant targets from an external command

I am not able to understand how launch files are created and how to set parameter to launchConfiguration tag.

The .launch files are created by Eclipse for every Run Configuration you want to be saved:

  1. Open Eclipse.
  2. Select a build.xml file.
  3. Through the context menu, execute 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:
-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. This will create the .launch file into your project, and let it available for further executions. (You should rename it).
  2. Execute Run .
  3. You can edit the .launch configuration in menu 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). Or in the Refresh tab, you can select which project directories you want to be refreshed after the script is executed, etc.

Launch configurations for Ant Builds are created and managed using the 'Run > External Tools > External Tools Configurations...' dialog.

You can import existing .launch files using 'File > Import... > Run/Debug > Launch Configurations'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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