Gradle dependency fallback - gradle

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?

Related

Issues with transitive dependency of a jar file - gradle

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

Tracing jars from BOM

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)

How gradle get all the dependencies of a third party library?

In my springboot application (kotlin+gradle) I'm trying to use one of my libraries stored in Nexus. This nexus-library needs some dependencies from AWS sdk and other repositories.
Must I configure gradle.build.kts with all the repositories needed to fetch all these extra dependencies?, does it know gradle where are all these dependencies directly from the Jar?, or.....how is this done?
Gradle will use the POM file for the dependency to work out any transitive dependencies, and will attempt to retrieve them from your configured repository. If they are not available directly from there then you'll need to add additional repositories into your Gradle configuration to tell Gradle where it can search for these dependencies.
For Gradle version 6, Gradle will try to resolve a dependency in the following order
Gradle module metadata (a JSON file with .module extention)
Maven metadata (.pom file) or Ivy metadata (.ivy file) depending on Maven or Ivy repository respectively
The artifact(E.g., jar) itself if no metadata is found. This has been disabled but can be enabled through an additional configuration.
See Gradle documentation for more information.

repackage external gradle dependencies using proguard

Is it possible to repackage external Gradle dependencies using proguard?
why?
I wanna repackage all external dependencies in our SDK because I don't wanna have a problem with dependency conflicts later when we will use this SDK in many different projects.

gral-examples Maven dependency

I added gral-core Maven dependency to my project as it is explained here
http://trac.erichseifert.de/gral/wiki/Download
Problem is that I also need to add gral-examples.jar in Maven dependencies, but I cannot find the code for it. I need this to work because I share this project with few other people via EGit plugin for Eclipse, so I can't just add this library to build path, I need it to be Maven dependency.

Resources