How to specify dependency's dependency's version?

A part of the module’s dependency tree:

| | ±-- com.github.pagehelper:pagehelper:5.1.4
| | | — com.github.jsqlparser:jsqlparser:1.0 -> 3.1
| | ±-- com.github.jsqlparser:jsqlparser:3.1

Jsqlparser and pagehelper both are dependencies of this module.
How to specify version of jsqlparser in pagehelper to 1.0?

It isn’t very clear what you pasted but what I think I see here is that:

  1. You have a transitive dependency that depend on pagehelper version 5.1.4 (your line 1: com.github.pagehelper:pagehelper:5.1.4)
  2. That same dependence also depends on jsqlparser 3.1 (your line 3: com.github.jsqlparser:jsqlparser:3.1).
  3. The pagehelper itself depends on jsqlparser 1.0. Gradle “knows” this (from its stated dependencies - you don’t need to restate this) and shows it: com.github.jsqlparser:jsqlparser:1.0. However, because you cannot have two different versions of the same dependency it has to choose one and it chose newer. It indicated this by showing -> 3.1.

That version conflict has to be resolved. You see what Gradle does. If you wish to resolve it differently, you may want to read the following when you have time:


… but for the quick solution read this:

(especially force and forcedModules, perhaps dependencySubstitution)