WAR file build in tomcat project - eclipse

I have a traditional tomcat project configured in eclipse. I could run it successfully through eclipse by providing the tomcat configuration like below,
Window->Preferences->Tomcat
Provided the Tomcat home and configuration file tomcat server.xml file.
In server.xml file i have provided the context declaration details to access the application.
Now, i would like to build the WAR file for this project using eclipse or ANT. When i try to export the WAR file using eclipse, the module name for the project is not captured.
Could anyone please give me the suggestion to build the tomcat deployable WAR file for Eclipse->Tomcat project.
Thanks in advance..,

Related

Difference between Tomcat war file and eclipse war file

What is the difference and similarity between war file which we are creating in eclipse and which we are creating in tomcat folder ?
war files are not generated by the tomcat. When web project build, war files are generated and it can be automatically deploy to the configured tomcat by in the eclipse.

Deploy IVY resolved war file to eclipse tomcat?

I am trying to understand whether it is possible to have an eclipse tomcat runtime configuration that will publish the IVY resolved war files when tomcat is started?
I have created a tomcat server instance in eclipse and pointed it at a catalina configuration which includes a server.xml that specifies the contexts. For example.
<Context docBase="Module1" path="/Module1"/>
Module1 is a resolved war file and I have added the corresponding ivy.xml file to the eclipse tomcat classpath. I can see the war file has been resolved, but I assume I must have to do something extra to get the war files auto deployed on server startup?

deploy my project directly without copying always the war file

I'm running a web application with maven + spring mvc + spring data jpa with apache tomcat in eclipse.
I want to deploy my application without opening eclipse and run tomcat inside it, so i have to export my project into war and copy it into apache-tomcat-7.0.42\webapps directory and it's working good.
My problem is that i want to work directly into apache-tomcat-7.0.42\webapps with eclipse so like that i don't have to export my war file after every changes in my code.
Just configure the Tomcat as server in eclipse and run the project from eclipse.
To configure tomcat in eclipse:
In Eclipse, go to Windows->preferences->Servers->runtime Environment, add tomcat here.
To run the project from eclipse:
right click project in Eclipse's project explorer and select->run as->run on server. select the tomcat you configured.

tomcat7 web servlet wouldn't work

So I'm using eclipse and wrote 2 separate project. My servlet project is using the JAR file from the other project and it runs fine on the tomcat server built in to eclipse. However, if I package the servlet project into a WAR file and deploy it on the tomcat7 directly on my machine (not through eclipse), then it wouldn't run. I'm worried it might be some problem with the classpath. When I ran in eclipse, I had to manually went in RunConfiguration and add those jar files into the tomcat server classpath. How would I do that through command line?
You shouldn't mess with the tomcat classpath. Put the jar in the WEB-INF/lib directory of your war, as all the other libraries that your webapp uses.

Where does eclipse publish(disk location) the web project?

When I run my web project in Eclipse, it publish the compiled class and html and jsp, etc.. to the webapps tomcat directory. But I couldn't find those files in the webapps directory of the tomcat that is set in eclipse configuration (CATALINA_HOME).
maybe it was hidden... umm no.. there aren't hidden files in the tomcat/webapps directory...
Anyone know where Eclipse copy my web project or how does eclipse to run my web projects??
Web projects in Eclipse will be published to
[workspace]/.metadata/.plugins/org.eclipse.wst.server.core/tmp[X]/wtpwebapps/
You can find the exact target in the Run Configuration of the Server.