I am new to using the m2eclipse plugin. I am using eclipse Helios 3.6.2. java: 220.127.116.11
I want to include various maven dependencies (.jar files) in my .war depolyment. I want these jars to end up in the war file under myApp/WEB-INF/lib.
Currently I can build the project using the traditional eclipse method: from the Tomcat option | Deploy to war file path. Eclipse is apparently building against my .m2 repository. But presently only my project classes are exported to the war.
1. By what steps do I select the maven dependencies in eclipse for export to WEB-INF/lib ?
2. Once these are set up, how can I run a maven command to build the war file from within eclipse that will export the dependencies? Should I run the command using maven or can I do it in eclipse?
For example, in a simple JDBC application connecting to say oracle, let's say I want to include the jta-1.0.1.jar in under WEB-INF/lib on deployment. I have an entry in my pom file for it, as a dependency. jta-1.0.1.jar needs to end up under myApp/WEB-INF/lib/.
Just ensure that your POM is set up to generate a WAR (and not something such as JAR, instead).
Dependencies in "compile" scope will automatically be copied to the target's WEB-INF/lib as part of the Maven build. Dependencies in "provided" scope will not (you would use this for server-supplied jars such as the JSP-api.jar).
To generate a WAR in Maven, 2 goals have to be run: "compile" and "war:war". Running the war goal alone won't compile the Java source . If you prefer, run one of the master goals, such as "package".
To run Maven in Eclipse, select the POM in the project explorer and select the "Run" context menu option. This will build and execute Maven run profile (or use an existing one). Maven run profiles behave just like regular run/debug profiles except that their profile edit dialogs support Maven-specific features.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Apr 08, 2003
Thank you very much Tim, this was an extremely helpful answer.
This helped loads
By the way, if you would have followed the maven directory and its subdirectories you would have eventually reached a copy of you pom.xml. Sometimes this is handy (especially when you examine a JAR file that you got from someone else) and sometimes it's not so handy (if you are writing proprietary software and you have the developer's email addresses in the <developers> section of the POM - you really want your customers to contact support, and not the developers directly).