简体   繁体   中英

Maven looking for artifact in wrong location

I have declared a dependency in one of my EJB module pom files for another module located within the project.

The project is structured as:

-- 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)

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 is saying that it cant find the module:

Failure to find eS.eL:elBLImpl:jar:1.0-SNAPSHOT in http://my-repo-location

Why is it looking for the elBLImpl in the repo, and not in the project itself?

This part is correct:

 eS.eL: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?

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 don't care how do you forming your project structure. After building artifact it put it to local repository. And every project (nested or not) can get any other articact only from that repository(if none other repository is defined). So if you have trouble with getting some artifact, but you build it - please check if that artifact <parent> , <artifactId> and <version> is same as you define as dependency.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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