How to Run/Debug a Ant Project in directly in tomcat through Eclipse? - eclipse

In this project ....
Web.xml is located under Project Folder > web > Web-INF > web.xml
This project is already created by or clients and we are maintaining it.
Actually we do the build using the build.xml script using ant, it will generate a app.war then we will deploy it in tomcat to run.
In the above process there is no way i can debug the code.
More info:
This is not a struts project, it is Spring MVC project

Why don't you add Ant plugin to eclipe and run it through eclipse?
Help: How to run ant project in eclipse
Running Ant buildfiles
To run an Ant buildfile in the Workbench:
In one of the navigation views, select an XML file.
From the file's pop-up menu, select Run Ant.... The launch
configuration dialog
opens.
Select one or more targets from the Targets tab. The order in
which you select the items is the order in which they will run. The
order is displayed in the Target execution order box at the bottom
of the tab. You can change the order of the targets by clicking the
Order... button.
(Optional) Configure options on the other tabs. For
example, on the Main tab, type any required arguments in the
Arguments field.
Click Run.
or Check this answer
Want an eclipse java project to run ant build files automatically

Related

Include Run Configurations in SVN project in MyEclipse

How can I configure MyEclipse and the SVN plugin (Subclipse 4.3.3) so that my Run Configurations are included in the source code control. Every time a new developer checks out the project, he doesn't have the Run Configurations needed to test the application properly or to do the Maven packaging correctly.
Is there a way?
To share your run/launch configuration, go to the launch configuration (Run > Run Configurations...) tab Common for Save as choose Shared file (instead of Local file).
In addition, you can choose to Display in favorites menu to add it to the drop-down of the corresponding button in the main toolbar.

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:
Open Eclipse.
Select a build.xml file.
Through the context menu, execute Run as/Ant build.... A dialog appears.
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
...
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).
Execute Run.
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'

Add Ant script lines to Eclipse build procedure

I'm making java project using eclipse. I suppose that Eclipse is using Ant to build project. Now I need to create jar file and to copy it over ftp. I need add few lines in Ant script file, but can't find where it is. What is the name of projects build script file?
Eclipse doesn't use Ant for building projects, at least not by default. However, you can add a new Ant Builder to your project, to make it execute an Ant build script each time the project is built: open the properties of your Java project, then select "Builders", click on "New", then select "Ant Builder" and click "OK", as in this screen capture:
In the next dialog, conifgure the Ant script and target you want to use to jar your project, and you're done. The jar will be built from your Ant script each time the Eclipse project is built or re-built.

Using Eclipse, how can i tell what version of ANT is being used?

Same as original question, using Eclipse, how can i tell what version of ANT it is configured to use?
In Eclipse Helios:
Open the Preferences dialog (Window -> Preferences)
Navigate to the Ant -> Runtime page
Expand the Ant Home Entries node on the Classpath tab
This shows the path used for Ant classpath, which also reveals ANT_HOME for Eclipse.
So by default in Helios you will have something like:
<ECLIPSE_ROOT>/plugins/org.apache.ant_1.7.1.v20100518-1145\lib\ant.jar
etc
On this same page, you can also change ANT_HOME to use a different version of Ant you have installed on your PC.
Create a build file and echo $ant.version
On Helios
create an empty build.xml
ctrl+space in the empty file and select the default build file template with 2 targets
in the target called "default" add <echo>${ant.version}</echo>
save the file
right click on the build.xml in the navigator
select run as ant build
In Eclipse Helios (version 3.6.2) the version of the various plug-in modules such as ANT can be determined in the following manner.
Select the Help -> "About Eclipse SDK" menu option
Click on the "Installation Details" button
Click on the "Plug-ins" Tab
The "Plug-in Name" column is where ANT can be found the version is in the next column.
There will probably be multiple references to ANT in the "Plug-in Name" column including
Ant Build Tool Core
Ant Launching support
Ant UI
Apache Ant
I believe the "Apache Ant" is the most relevant entry and the others deal with how ant integrates with eclipse.

Eclipse Generated Build Files

I am using the ZK Studio plugin to create a web based project based on the ZK framework. Now, in order to deploy this project, all I do is right click on the project and select "Export" then select "WAR file". However, I would like build files to be created so that someone else can just make a change and run the build file to re-compile and create the WAR file automatically. I have been told that Netbeans does this automatically, and it seems so does eclipse since it allows me to just say "Export as WAR". However, I need to commit build files to the svn as well. How can I get this option through eclipse?
Thanks!
P.S. I have seen this question:
Generating Ant build file for a project in eclipse
But I do not have that option when I right click for some reason.
Select build.properties file in project explorer view and from context menu (right click) select PDE Tools -> Create ant build file.
Same can be achieved through an ant task as well. See http://help.eclipse.org/helios/index.jsp?nav=/4_2_0