Maven Repo: Could not resolve dependencies - Could not find artifact

Hello, I am working on a pipeline for my Java/Maven projects. We have a hosted Gitlab with maven-repo enabled and have two projects where one is dependent on the other. The dependency builds just fine and I can see the artifact deployed under the packages folder of the project. The problem is while building the parent project, it fails to find the dependency.

Below are the repository settings for both: Dependency Project:

<distributionManagement>
      <repository>
        <id>my-repo</id>
        <url>https://gitlab.xyz.net/api/v4/projects/${env.CI_PROJECT_ID}/packages/maven</url>
      </repository>
      <snapshotRepository>
        <id>my-repo</id>
        <url>https://gitlab.xyz.net/api/v4/projects/${env.CI_PROJECT_ID}/packages/maven</url>
      </snapshotRepository>
 </distributionManagement>

Parent Project:

<repositories>
      <repository>
        <id>my-repo</id>
        <url>https://gitlab.xyz.net/api/v4/projects/**dependency_project_id**/packages/maven</url>
      </repository>
    </repositories>
    
    <distributionManagement>
      <repository>
        <id>my-repo</id>
        <url>https://gitlab.xyz.net/api/v4/projects/${env.CI_PROJECT_ID}/packages/maven</url>
      </repository>
      <snapshotRepository>
        <id>my-repo</id>
        <url>https://gitlab.xyz.net/api/v4/projects/${env.CI_PROJECT_ID}/packages/maven</url>
      </snapshotRepository>
    </distributionManagement>

On the parent project pom I tried using both project level (with project id hard coded) and group level urls in the but neither seem to work.

I also tested using an external maven repo (Artifactory) and everything seem to work just fine.

Below is the error message: [ERROR] Failed to execute goal on project parent: Could not resolve dependencies for project com.xyz.abc.io:parent:jar:0.0.1-SNAPSHOT: Could not find artifact com.xyz.abc.io:child:jar:0.0.1-SNAPSHOT in my-repo (https://gitlab.xyz.net/api/v4/projects/**dependency_project_id**/packages/maven)

Please let me know if you need any more info.

Assignee Loading
Time tracking Loading