Maven在错误的位置寻找工件 [英] Maven looking for artifact in wrong location
问题描述
我已经在我的EJB模块pom文件之一中声明了项目中另一个模块的依赖关系.
I have declared a dependency in one of my EJB module pom files for another module located within the project.
该项目的结构为:
-- eS
|-- pom.xml
|-- eL
| |-- pom.xml
| |-- eLBO
| |-- eLDAO
| |-- eLBLImpl
| |-- eLEJB
| | |-- pom.xml
| | `-- src
| | `-- main
| | |-- java
| | | `-- eleague
| | | `-- ejb
| | `-- resources
| | `-- META-INF
| | |-- beans.xml
| | |-- persistence.xml
| | |-- (ejb-jar.xml)
| | `-- (jboss-ejb3.xml)
elBLImpl被打包为JAR,我需要更新elEJB目录中的pom.xml文件,以添加对elBLIMpl的依赖关系.我试过了:
The elBLImpl is packaged as a JAR, and I need to update the pom.xml file in my elEJB directory, to add a dependency on elBLIMpl. I tried this:
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>elBLImpl</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
Maven表示找不到模块:
Maven is saying that it cant find the module:
Failure to find eS.eL:elBLImpl:jar:1.0-SNAPSHOT in http://my-repo-location
为什么要在回购中而不是在项目本身中寻找elBLImpl?
Why is it looking for the elBLImpl in the repo, and not in the project itself?
这部分是正确的:
eS.eL:elBLImpl
这是elEJB依赖的模块.但是为什么Maven在外部仓库中查找,该模块是项目本身的一部分.我一定不太了解Maven,对不起.从我的EJB中,我需要在elBLImpl模块内创建类的实例.
That is the module that elEJB depends on. But why is maven looking in an external repo, the module is part of the project itself. I must not understand maven too well, sorry. From within my EJB, I need to create instances of the classes inside the elBLImpl module.
推荐答案
只是一个猜测,因为我们需要更多信息,但是您是否已安装父代工件以供查找?
Just a guess since we need more information, but have you installed the parent artifact for this one to find?
此外,您没有指定Maven在哪里寻找特定的依赖项.您只需定义所有存储库位置,Maven便会查找所有存储库位置(包括.m2
中的Maven本地存储库)以尝试找到它们.
Also, you don't specify where Maven should look for a particular dependency. You simply define all your repository locations, and Maven looks in all of them, including your Maven local repo in .m2
, to try to find them.
这篇关于Maven在错误的位置寻找工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!