Maven依赖版本控制和java

Maven依赖版本控制和java

本文介绍了Maven依赖版本控制和java.lang.NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Java项目X对项目Y具有依赖关系(在pom文件中).

I have a Java project X has dependency (in pom file) on project Y.

我正在Y中进行修改,并使用Maven工具构建了X,Y,然后在JBoss上运行X却没有问题.

I was modifying in Y and build X,Y with Maven tool then runing X (on JBoss) without problems.

当我在Y中添加新类,然后使用Maven构建(没有问题),然后运行X时,它将为新类抛出java.lang.NoClassDefFoundError.

When I added new class in Y then building with Maven (without problems), then running X, it throws java.lang.NoClassDefFoundError for the new class.

我认为它是Maven依赖版本控制或类似的东西...我主要在Google上搜索,但没有任何效果...如何解决此问题?

I think its a Maven dependency versioning or something like that ... I searched mainly at Google but nothing has effect... How to resolve this problem??

推荐答案

好的,很抱歉提供最新信息.

Ok, sorry for late info.

X包是ejb,因此X.jar没有lib目录.

The X package is ejb, so the X.jar has no lib directory.

然后将Y.jar放在Jboss/server/default/lib中,它可以正常工作.

Then Y.jar should be placed in the Jboss/server/default/lib, it worked correctly.

感谢所有人.

这篇关于Maven依赖版本控制和java.lang.NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 18:44