I am new to Maven. I am trying to write my first Webapplicaiton using Maven and Spring... MyFirstMavenWebApp.
I used the eclipse and tomcat. Using eclipse i generated one Maven webapp using achtype web-app. after writing some java files.. i just ran Maven Clean,package and i got the classes, dependent jars and all the resources copied to target/MyFirstMavenWebApp folder and a war file also created.
But i could not see this project in my Tomcat add/remove tab.. so i just changed the Web application facets to Dynamic Web project.. now i am able to add the project to tomcat...
But unfortuanately tomcat is taking the src/main/webapps as base directlry and there i dont have any classes or jars copied.. so my deployment is failing....
When i copy the war file from target folder to WebApps directory of Tomcat outside the eclipse ... its working fine..
Can you help to solve this..
I need Tomcat in clipse to point to the target/MyFirstMavenWebApp instead of src/main/webapps..
Bala Gangadhar wrote:I already have m2e-wtp plugin .. do i need to specify that plug in in pom.xml ??
m2e-wtp is an Eclipse plugin. It doesn't go into pom.xml. A pom.xml should be written in such a way that it has absolutely no dependencies on your IDE or any software installed only on your system. It should build from any system that has maven installed.
If you have Web Development Tools plugin installed (which it appears you do considering that you can add dynamic web facet and create Tomcat server runtimes) and m2e and m2e-wtp installed, you don't need anything else. I'm not sure why it's not working for you.
Can you describe the exact steps you are trying? For example, I don't see have tab called Tomcat. Where are you seeing it?
Can you create a new fresh maven web app project without manually adding any facet and see if it's working?
posted 3 years ago
Thanks a lot for your help Karthik.... I Got it...
Steps i followed..
1. I added below entry in pom.xml in plugins..