Original: http://blog.csdn.net/yirentianran/article/details/6429240
When standard WEB engineering uses the M2eclipse plug-in to add dependency management in Eclipse, the dependent jar packages are not automatically copied to/web-inf/lib during deployment.
Refer to some friends ' practices manual execution [Java] view plain copy mvn dependency:copy-dependencies-doutputdirectory=src/main/webapp/ Web-inf/lib-dincludescope=runtime
command to copy the jar package to the/web-inf/lib directory.
This is possible, but it can also cause some inconvenience.
1, need to execute the command manually.
2, can not be updated constantly.
The following is a list of the workarounds found on the web, and the M2eclipse plugin method has been validated.
By verifying the Eclipse version: Eclipse-jee-helios-sr2-win32
M2eclipse Plugin Address: http://m2eclipse.sonatype.org/sites/m2e
Standard Web Engineering adds dependency management steps through M2eclipse:
1, "Maven" –> "Enable dependency Management"
2. Add Maven dependencies to the Web Deployment assembly
The steps are shown below:
Preferences, right-click Project
There are modifications in the. classpath file
[XHTML] View plain copy <classpathentry kind= "con" path= " Org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER "/>
is [XHTML] View Plain Copy <classpathentry kind= "con" path= "Org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER" > <attributes> <attribute name= "Org.eclipse.jst.component.dependency" value= "/web-inf/lib"/> </attributes> </classpathentry>
(perform "Maven" –> "Update Project The Configuration "is not in effect, so add it manually. It is necessary to deploy the jar package to the Lib directory, rather than copy the jar package when updating Maven dependencies. )