Hi I am a newbie to gradle dependency management ...
# community-support
p
Hi I am a newbie to gradle dependency management I am trying to setup a project with wang.avi available in maven as artifact For some reason gradle cannot find this dependency and failing the build Here is my gradle configuration: Gradle version: 8.0.12 Groovy: 3.0.22 Launcher JVM: 17.0.2 OS: Windows 11 Here is the configuration for settings.gradle: dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() maven { url 'https://jitpack.io' } maven { url 'https://custom-repo/' # nexus } jcenter() } } I kindly request anyone's help in this please. What could be wrong am I missing anything basic considering I am a newbie For security reasons I have masked my custom repo endpoint. Hope this is accepted. Thanks.
n
what error are you getting?
☝️ 1
☝🏻 1
g
And have you verified in Nexus that the dependency at that particular version exists in Nexus? Also, if that Nexus path is a mirror, you could review its settings to make sure they’re as you expected (origin repo URL, etc.)
p
@Niels Doucet @Gabriel Feo Thanks a lot for your response This dependency is available in Maven Repository from where I am expecting it to download This is not in nexus repo. This version I want to download: https://mvnrepository.com/artifact/com.wang.avi/library/2.1.3
This is the error @Niels Doucet
Please ignore the highlighted one as gradle is trying all possibilities in repositories declared...
g
You can search in maven central to confirm if it exists there (it doesn’t): https://central.sonatype.com/search?q=com.wang.avi%3Alibrary%3A2.1.3 If this is the library you’re talking about, it’s abandoned and there are issues about that.
p
Thanks a lot @Gabriel Feo You are right It doesn't exist in maven central.
🙂 1
v
A few notes: • I recommend switching to Kotlin DSL. By now it is the default DSL, you immediately get type-safe build scripts, actually helpful error messages if you mess up the syntax, and amazingly better IDE support if you use a good IDE like IntelliJ IDEA or Android Studio. • mvnrepository.com != Maven Central. That page is an indexing page which indexes several repositories. If you look at the page you linked, you see that that version of that library is available on "Grails Core", "Spring Lib M", and "Spring Plugins" repositories, but not on "Central" repository. So you would need to use one of those repositories to resolve the dependency. •
jcenter()
adds JCenter repository which by now is just a redirect to Maven Central. So as you have Maven Central already in your repository list this is a no-op and actually just wastes time for not found dependencies as they are searched in Maven Central again. • If do not really need JitPack, I strongly recommend you remove it. It is broken by design for proper publishing, unreliable, slow, and buggy. If you really need it as some lazy maintainer does not provide proper publishing, you should at least move it to the last position in the list of repositories and optimally use a repository content filter to define exactly which artifacts need to be taken from it.
p
Noted @Vampire Thanks for your inputs. I am aware of that mvnrepository being an index page I did try to find dependency in Grails Core link given in index page but no luck the dependency is unavailable there too
👌 1