I am using gradle for dependency resolution but we rely on a library with cannot be resolved from a repo. As a workaround they asked us to use a workaround like :
implementation (files($network-file-path/lib.jar))
but this in turn is bringing a lot of transitive dependencies and causing a lot of trouble. I am very new to gradle and could not find a fix.
Is there a way through I can omit all the transitive dependencies of this specific jar ?
We are using gradle version 7.3.3
Related
Is there a way to use fallback dependency in gradle.
For example, there is dependency com.example.module:artifact:version.
How can I "ask" gradle do not crash building if no this artifact found on any of specified repositories, but try to use com.example.fallback_module:vallback_artifact:fallback_version instead?
A jar has been removed from organization's repository for being unsafe, but we can download its pom. We are trying to figure which dependencies of a project are dependent on it. Tried running gradle dependencies but that doesn't complete due to the same missing jar.
Is there any gradle command or something similar to create dependency tree for the project without trying to download jars? As far as I understand, creating dependency tree should only require POMs. Please correct me if I am wrong. I am somewhat new with gradle.
Is there an easy way for me to trace a jar back to which BOM artifact it is from?
I need to upgrade org.dom4j:dom4j, but I need to figure out which of the artifact brings it in. Is there a way to print out all the transitive dependencies in Gradle? Thanks!
Depending on if you use gradle wrapper or not, gradlew dependencies or gradle dependencies should give you the dependency tree, but it doesnt show which BOM sets a specific version.
But it will show you if a dependency forces another dependency to chance its expected version.
I would recommend pipe it to a file to read easier (windows == gradle dependencies > dependencies.txt)
In my build.gradle , for one of the direct dependency A , "jersey-client" 2.25.1 is transitive dependency. But when I do gradle build it downloads 2.7 version, when I check dependency A pom, it has only 2.25.1 version, how Gradle resolves it to 2.7?
There are versions above 2.7 as well in the artifactory, how only 2.7 is downloaded?
Only dependency A is using jersey-client.
Cleared gradle cache and tried, but same result.
There's probably another dependency in your dependency graph bringing in a later version. Try running
gradle dependencies
And it should show some insight into why it chose the newer version. Gradle has a few strategies allowing you to force a particular version of a dependency or perhaps ignoring transitive dependencies of a particular dependency should you wish to do so
Spring dependency management plugin is overriding jersey 2.25.1 with 2.7,
I have explicitly declared in my build.gradle file to use 2.25.1 by adding the below property.
ext['jersey.version'] = '2.25.1'
We're switching build system from Ant to Gradle, mainly to benefit from the "automagic" dependency management. However, I'm having great problems resolving jug 2.0.0.
I've defined it in my build.gradle file like this:
compile 'org.safehaus.jug:jug:2.0.0'
which corresponds to the name of the artifact entry in Maven Central, but when I look in my Gradle cache only the pom.xml file has been downloaded - no jars.
Looking at the artifact details on the Maven Central search page, it seems there are three files; jug-2.0.0.pom, jug-2.0.0-asl.jar and jug-2.0.0-lgpl.jar, where the difference between the latter two is the license (Apache Software License vs LGPL). I've tried adding -asl and -lgpl to the version number in the dependency specification, but it didn't help.
How do I correctly define this dependency, so that the jar files are downloaded and referenced?
The 'lgpl' part of the dependency is the classifier. Try to resolve it using:
dependencies{
compile 'org.safehaus.jug:jug:2.0.0:lgpl'
}