0

I am facing a problem while building a Maven module. I am following module-based architecture, I have a parent project named Bikewale and it's child modules named Bike-repo, Bike-service, and Bike-web. When I am trying to add Bike-repo dependency in Bike-service's pom file I am facing Maven Build Failure error saying:

[ERROR] Failed to execute goal on project Bike-service: Could not resolve dependencies for project ab.sp:Bike-service:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at ab.sp:Bike-repo:jar:0.0.1-SNAPSHOT: Failed to read artifact descriptor for ab.sp:Bike-repo:jar:0.0.1-SNAPSHOT: Could not find artifact ab.sp:Bikewale:pom:0.0.1-SNAPSHOT -> [Help 1]

Although I checked in my .m2 repository that whether Bike-repo is present there or not, and it is present there. I was not facing this issue in my previous projects.Screenshot of .m2 repository

Bike-repo's pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>ab.sp</groupId>
    <artifactId>Bikewale</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
  <artifactId>Bike-repo</artifactId>
</project>

Bike-service's pom.xml:

where I am adding dependency of Bike-service:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>ab.sp</groupId>
        <artifactId>Bikewale</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <artifactId>Bike-service</artifactId>
    <dependencies>
        <dependency>
            <groupId>ab.sp</groupId>
            <artifactId>Bike-repo</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
    </dependencies>
</project>
2
  • Can you add the parent pom as well? Do you have the <modules> list set up there? Commented Feb 28, 2020 at 12:15
  • 1
    word of advise: use lowercase groupId and artifactId names. Some filesystems are case insensitive... others are not. Commented Feb 28, 2020 at 12:24

1 Answer 1

1

You're missing the artifact ab.sp:Bikewale:pom:0.0.1-SNAPSHOT. That is the parent pom.

If you do a 'mvn install' in the parent directory, it should install first the parent pom, then the Bike-repo pom and jar, and then the Bike-service pom and jar.

Sign up to request clarification or add additional context in comments.

2 Comments

Sorry, I did not get what was missing in pom. @Amit Can u post corrected pom with edit tag?
Yes, @Jarvis42, I was adding one module's dependency into another module, but after adding when I was performing mvn clean install command I was facing build failure for that dependency's jar. @GreyFairer suggested me to do mvn install in parent project, and that resolved my issue.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.