有一个工程wechat-standard,工程有五个模块,其中两个模块是wechat-standard-common(打包成jar),wechat-standard-admin(打包成war).wechat-satndard-admin依赖于wechat-standard-common。编译打包后,在eclispe中用jetty插件运行wechat-standard-admin项目,有如下报错:
WARNING: PWC6351: In TLD scanning, the supplied resource file:/C:/Users/Administrator/.m2/repository/com/sqq/wechat-standard-common/1.1-SNAPSHOT/wechat-standard-common-1.1-SNAPSHOT.jar does not exist
java.io.FileNotFoundException: C:\Users\Administrator.m2\repository\com\sqq\wechat-standard-common\1.1-SNAPSHOT\wechat-standard-common-1.1-SNAPSHOT.jar (系统找不到指定的路径。)
查看eclipse项目的builder path,发现wechat-standard-common-1.1-SNAPSHOT.jar依赖项 是missing状态,对应的路径是本地maven仓库路径
解决这个问题有两个方法:
1.对wechat-standard-common执行maven install命令,将其安装到maven本地仓库(和maven deploy不同,不会发布到远程仓库),这样就可以在本地仓库中找到这个jar包
2.项目右键->properties->Maven ,勾选rosolve dependencies from workspace projects (方法1对应得是不勾选)
这两种方法是让eclispe运行项目通过不同的方式找依赖的jar包。
如果项目通过package打成war包,部署到tomcat运行,则不存在这种问题,应该package会自动在wechat-standard-common打包后放到war中

本文介绍了一个在Eclipse中使用Jetty插件运行WAR包时遇到的缺失JAR文件问题,并提供了两种解决方案:一是通过Maven安装命令将JAR文件加入本地仓库;二是调整Eclipse设置,从工作区项目中解析依赖。
2833

被折叠的 条评论
为什么被折叠?



