[ACCEPTED]-Want an eclipse java project to run ant build files automatically-ant
Step 1: Add the build file to your ant view
Click 22 the add button and select the build.xml 21 file from the project. You can also drag 20 the build.xml file onto the ant view (To 19 add the ant view to your perpective, go 18 to Window > Show View > Other…)
Step 17 2: Run as Ant Build
In your ant view, right 16 click the newly added build file and select 15 Run As > Ant Build… In the dialog window, select 14 the ‘Hide internal targets not selected 13 for execution’ option in the Targets tab. You 12 can rename the builder in the box at the 11 top of the window if you wish (I usually 10 remove the trailing ‘build.xml’. Click Apply 9 and Close.
Step 3: Setup automatic build
Right 8 click on the project, select Properties, then 7 Builders. Click Import. Before closing the 6 screen, highlight the imported build and 5 select edit. Go to the Targets tab select 4 clean for ‘After a clean’ and deploy.local 3 for ‘Auto build’. Apply the changes and 2 close.
Step 4: Enable Auto Build
Go to Project 1 > Build Automatically
source: http://www.simonwhatley.co.uk/using-ant-with-eclipse
Go to your project properties, select "Builders", and 5 add a new Ant Builder. You may specify which 4 targets to run at what time (during a clean, after 3 a clean, etc.), and which resources (if 2 any) to refresh in Eclipse after your ant 1 target is executed.
Project/Builders/New/Ant Builder
There you 1 can add your custom ant build.
At least with Eclipse 4.2 (Juno), the ability 6 to auto-build with Ant has been removed. Under 5 the builder configuration -> "Auto Build", there 4 is a message: "". That said you, can still 3 work around this by:
- Follow the steps above for creating your Ant builder. This will create a file in projectDirectory/.externalToolBuilders.
- Modify projectDirectory/.externalToolBuilders/YourLaunchName.launch:
- You'll need to add auto, to this line:
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
- Specify the target you want run for auto by adding:
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="compile-jar,"/>
- You'll need to add auto, to this line:
You can look at your 2 Ant builder configuration and see that everything 1 looks good:
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.