Gradle trying to download parent pom dependency as jar file

I am migrating a project from maven to Gradle.


<parent>
 <groupId>com.xxxxxx.unifiedframework</groupId>
    <artifactId>uf-soap-parent</artifactId>
    <version>2.7.3</version>
</parent>

For the above maven dependency,
It’s Gradle equivalent, I defined in build gradle is as follows.

dependencies {
   Implementation(platform ("com.xxxx.unifiedframework:uf-soap-parent:2.7.3"))
}

When I did local build, it’s was successful.
But when I pushed my code to git, Jenkins jobs failing
With following error

What went wrong:
Execution failed for task: 'DecisioningRulesServiceApplication:war'.
Could not resolve all files for configuration 'DecisioningRulesServiceApplication:runtimeClasspath'.
Could not find com.xxxxxx.unifiedframework:uf-soap-parent:2.7.3.
15:31:53 Searched in the following locations:
15:31:53 - 

https://artifactory.xxxxx.com/artifactory/maven-external-virtual/com/xxxxx/unifiedframework/uf-soap-parent/2.7.3/uf-soap-parent-2.7.3.jar

From the error, we can say that it’s looking for jar file, but it’s should look for parent pom file.

Note that build was successful in my local, facing issue when the Jenkins jobs run.

When I commented mavenLocal(), then local build also failing with same above error.

Yeah, using mavenLocal() is seldomly a good idea as it is broken-by-design in Maven already. The main effects are, that your builds become unreliable, non-reproducible, flaky, and slow. If you really must use it, it should always be the last in the list of repositories and always with a repository content filter that controls what exactly is resolved from it. See Declaring repositories for more details about that.

Regarding the actual error, it is hard to tell what causes this without seeing your build.
If you only use it as platform(...) it should not try to get the jar I think.
Well, maybe if the packaging is not correctly set to pom, I’m not sure.
Maybe some other dependency depends on it badly as dependency or something like that. :man_shrugging: