简体   繁体   English

从属jar不会部署到在工作空间中打开带有此jar的项目的tomcat

[英]Dependant jar doesn't deploy to tomcat where project with this jar is open in workspace

Strange problem, I've got two projects in workspace: 奇怪的问题,我在工作区中有两个项目:

ProjectA 项目A

ProjectB 项目B

in pom.xml in projectA i've added: 在projectA的pom.xml中,我添加了:

<dependency> <groupId>groupid</groupId> <artifactId>projectB</artifactId> <version>version</version> </dependency>

And when I build application and deploy to tomcat, there is in logs : " NoClassDefFoundError" I've noticed, if I close projectB then immediately app in tomcat works properly. 而且,当我构建应用程序并将其部署到tomcat时,记录在日志中:“ NoClassDefFoundError”,我已经注意到,如果我关闭projectB,则立即在tomcat中运行app即可正常工作。 If I open project then app is crushing. 如果我打开项目,则应用程序崩溃了。

When ProjectB is open, eclipse uses your workspace project to resolve ProjectB dependency. 当ProjectB打开时,eclipse使用您的工作区项目来解决ProjectB依赖关系。 If it is closed, the dependency is taken from your maven repository. 如果关闭,则依赖关系将从您的maven存储库中获取。 This is why the behavior is different. 这就是为什么行为不同的原因。

Have you checked that the missing class is indeed in ProjectB ? 您是否检查了缺少的类确实在ProjectB中? If it is, have you checked that the class compiles correctly ? 如果是,是否检查了类是否正确编译? Also, it could be that the class looks ok but is not compiled because ProjectB has build path errors. 另外,可能是该类看起来不错,但由于ProjectB具有生成路径错误而未编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM