aspose file tools*
The moose likes Struts and the fly likes Problems creating the Struts 2 application,  with Ant to build the application. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problems creating the Struts 2 application,  with Ant to build the application." Watch "Problems creating the Struts 2 application,  with Ant to build the application." New topic
Author

Problems creating the Struts 2 application, with Ant to build the application.

Agooner kumar
Greenhorn

Joined: May 17, 2011
Posts: 4
Hi,
I am a newbie to Struts and was following the Apache Struts 2 documentation. But my process of learning halted right at the Step 2 and cant proceed further. Apache Struts 2 documentation
If you follow the link, you will see that the Step 2 mentions about Running the Ant target that creates the WAR file. I have no idea how to run the Ant target and deploy.
Basically all I want to know is to deploy a struts application on to tomcat server using Ant and eclipse. How do I do that?
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

Welcome to JavaRanch !

If you have "Ant" installed, use the following command where you have the "build.xml"

say your project build.xml is in C:\Documents and Settings\MyProject\
then open up the console and type ->


it should start building a "war/ear/jar" file at the given location inside your build.xml.

Hope that helps.

Happy Programming


Time is what we want the most, but what we use the worst. -- William Penn
Agooner kumar
Greenhorn

Joined: May 17, 2011
Posts: 4
Hi Robin,
Thanks for the reply. I am using the build.xml file from the example project of Struts documentation. I was running the build.xml file as "Run As Ant Build" from Eclipse and I got the following error:

BUILD FAILED
C:\HeliosSpace\Basic_Struts2_Ant\build.xml:69: srcdir "C:\HeliosSpace\Basic_Struts2_Ant\${source.home}" does not exist!


Can you please tell me, what I am missing out here. Also it seems very few material is available on how we can deploy an application and WAR file. Any resources you can point me to would be helpful.

PS: Tried attaching the build.xml file, but I was unable to do so. Not even .txt extension.

Thanks,
AG.




Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

well you can always copy / paste the contents of the xml file using Code tags in the forum if you cant attach the file.
The sample build.xml file should have all the contents that you need. The source.home property should be defined in a file called "build.properties".

and try using the command prompt instead of eclipse.. we can separate out the "ant" and "eclipse" related issues then..
 
jQuery in Action, 2nd edition
 
subject: Problems creating the Struts 2 application, with Ant to build the application.