-4

I want to convert below Maven dependency to Gradle:

<dependency>
  <groupId>x.y.z</groupId>
  <artifactId>foundationcore</artifactId>
  <version>RELEASE</version>
</dependency>

What would be the corresponding version in Gradle?

compile group: 'x.y.z', name: 'foundationcore', version:?
halfer
  • 19,824
  • 17
  • 99
  • 186
  • I got my answer. Plz refer https://stackoverflow.com/questions/10370422/gradle-getting-the-latest-release-version-of-a-dependency/29492062 It worked for me. – shiba goyal Jan 31 '19 at 04:48

1 Answers1

1

Yes. If you have maven dependency:

<dependency>
    <groupId>org.dependency</groupId>
    <artifactId>name-of-dependency</artifactId>
    <version>RELEASE</version>
</dependency>

the gradle alternative would be:

compile group: 'org.dependency', name: 'name-of-dependency', version: 'RELEASE'

EDIT It might be a shot in the dark because you simply didn't provide enough information but if you're still experiencing the problem even though compile group is correctly translated. It might be a problem with .m2 folder. But that's if you're talking about a local repository.

RoughTomato
  • 405
  • 7
  • 16
  • In my case, version is RELEASE not x.y.z. Same I need to convert to gradle – shiba goyal Jan 30 '19 at 05:42
  • Shiba, if your dependency is public (and also not confidential) could you provide us with it? Note that if it is in [maven central](https://search.maven.org/), the Gradle script is provided so it is just a matter of copy-pasting inside your build.gradle. – tryman Jan 30 '19 at 05:51
  • yeah, my dependency is confidential not public. My maven build is fine and corresponding jar is available in maven central. – shiba goyal Jan 30 '19 at 05:57
  • it always follows the same pattern I provided with my answer. In your case, x.y.z is just RELEASE. – RoughTomato Jan 30 '19 at 06:30