Maven管理的jar没有发布到WEB-INFlib下的解决方案.doc_第1页
Maven管理的jar没有发布到WEB-INFlib下的解决方案.doc_第2页
Maven管理的jar没有发布到WEB-INFlib下的解决方案.doc_第3页
Maven管理的jar没有发布到WEB-INFlib下的解决方案.doc_第4页
Maven管理的jar没有发布到WEB-INFlib下的解决方案.doc_第5页
已阅读5页,还剩6页未读, 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Maven管理的jar没有发布到WEB-INF/lib下的解决方案标准web工程在eclipse中利用m2eclipse插件添加依赖管理后,在部署过程中没有将依赖的jar包自动拷贝到/WEB-INF/lib中。参考了一些朋友的做法手动执行javaview plaincopy1. mvndependency:copy-dependencies-DoutputDirectory=src/main/webapp/WEB-INF/lib-DincludeScope=runtime命令将jar包拷贝到/WEB-INF/lib目录下。这种做法固然可以,但是也会带来一些不便。1、需要手动执行命令。2、不能时时更新。 以下列出网上查找到的解决方法,m2eclipse plugin方式已验证通过。通过验证eclipse版本:eclipse-jee-helios-SR2-win32m2eclipse插件地址:/sites/m2e标准web工程通过m2eclipse添加依赖管理步骤:1、“Maven ” “Enable dependency Management“2、Web Deployment Assembly中添加maven dependencies步骤如下图:工程 - 右键 - preferences.classpath文件中会有修改xhtmlview plaincopy1. 为xhtmlview plaincopy1. 2. 3. 4. 5. (执行“Maven ” “Update Project Configuration “未生效,故手动添加。必须deploy时候才会拷贝jar包到lib目录下,而非在更新maven依赖时候拷贝jar包。)以下为原文内容:Eclipse : Web Deployment Assembly & Maven dependencies issuePublished: September 3, 2010 , Updated: September 3, 2010 , Author: mkyongprintProblemIn 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 Dependenciesxhtmlview plaincopy1. .2. 4. 5. 6. 7. 8. .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 Assemblyxhtmlview plaincopy1. .2. 4. 5. 6. 7. 8. .Sadly, the default(value=”./”)makes all the Mavens dependencies failed to deploy.SolutionNot 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 :1. WTP SupportIgnore the “Referenced Projects Classpath Entries” settings, instead, make the Maven supports WTP 2.0javaview plaincopy1. mvneclipse:eclipse-Dwtpversion=2.0It will generate a new file named “ponent“, under “settings” folder, see a portion of this file :File : “ponent”, by WTPxhtmlview plaincopy1. .2. 4. uses5. 6. .With WTP support, it helps to deploy the Maven dependencies to “/WEB-INF/lib” folder correctly.2. m2eclipse pluginInstall them2eclipse, an Eclipse plugin to integrate Maven into the Eclipse IDE. After the installation, right click on the project folder, select “Maven” “Update Project Configuration“, it will update the “.classpath” file accordingly, see a snippetFile : “.classpath”, by m2eclipsexhtmlview plaincopy1. .2. 3. 4. 5. 6. 7. .It helps to deploy the Maven dependencies correctly as well.Reference1. /2. /maven/maven-dependency-libraries-not-deploy-in-eclipse-ide/3. /forums/inde

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论