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>
deadshot
  • 8,881
  • 4
  • 20
  • 39
Amit
  • 231
  • 1
  • 8
  • 19
  • Can you add the parent pom as well? Do you have the list set up there? – GeertPt Feb 28 '20 at 12:15
  • 1
    word of advise: use lowercase groupId and artifactId names. Some filesystems are case insensitive... others are not. – Gimby Feb 28 '20 at 12:24

1 Answers1

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.

GeertPt
  • 16,398
  • 2
  • 37
  • 61
  • Sorry, I did not get what was missing in pom. @Amit Can u post corrected pom with edit tag? – Jarvis42 Feb 28 '20 at 14:04
  • 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. – Amit Feb 28 '20 at 14:48
  • Understood. Thanks @Amit – Jarvis42 Mar 02 '20 at 08:49