有一个工程 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 中
来源: http://www.bubuko.com/infodetail-3109168.html