maven web 项目导入eclipse 发布时不自动拷贝依赖包到lib
maven web 项目导入eclipse 发布时不自动拷贝依赖包到lweb-inf/ib问题 。
In Eclipse 3.5 or early version, in order to deployed the Maven dependencies to the correct “/WEB-INF/lib ” folder, you have to configure the dependencies via “Java EE Module Dependencies”, and the updated “.classpath ” file will look like following :
File : “.classpath”, by Java EE Module Dependencies…
Since Eclipse 3.6, the “Java EE Module Dependencies” is replaced by “Web Deployment Assembly”, but you can do the same via the “Referenced Projects Classpath Entries”, however, it will update the “.classpath ” file as following :
File : “.classpath”, by Web Deployment Assembly…
Sadly, the default (value=”../”) makes all the Maven’s dependencies failed to deploy.
Not a big issue, you still can modify the (value=”../”) to (value=”/WEB-INF/lib”) manually, but it will get override every time you run a Maven build. No worry, there are still have two solutions :
Ignore the “Referenced Projects Classpath Entries” settings, instead, make the Maven supports WTP 2.0
It will generate a new file named “org.eclipse.wst.common.component “, under “settings ” folder, see a portion of this file :
File : “org.eclipse.wst.common.component”, by WTP
With WTP support, it helps to deploy the Maven dependencies to “/WEB-INF/lib ” folder correctly.