Before the world of `platform(<dep>)` (Grad...
# dependency-management
c
Before the world of
platform(<dep>)
(Gradle 2.8 to be precise), did Gradle properly work with importing boms? I'm working with an old build that I cannot upgrade. The POM of one of the deps contains:
Copy code
<dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>my.group</groupId>
        <artifactId>myPlatform</artifactId>
        <version>1.2.3</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
That platform contains a
dependencyManagement
element as expected, however the versions listed appear to have no influence on the resolved dep tree. I cannot recall whether such an old Gradle version fully resolves dep management sections or not, and I'm not sure if I've got something broken in the build or if it's just the Gradle version.
j
Gradle 2.8 was before my time but knowing how things work today I would expect the dependencyManagement section to have no effect. Though I can’t say for certain. Have you tried the spring dependency management plugin? AFAIK that implements platform like bom support and was the standard way to use a bom pre native platform support. Curious if you can go into why you’re having trouble upgrading. Gradle 2.8 is ancient at this point and you’re missing out on a ton of performance improvements and features
c
This particular build is buried inside a deployment tool and leverages a bunch of "software model" stuff that was abandoned in Gradle. Upgrading is a fair amount of effort and is certainly in the queue, but it's not been a priority. The tool has just kept working for nearly a decade. 🙂 In the dep tree the tool resolves I was hoping I could get "version alignment" to work, using just poms and not require the new Gradle/module metadata.
v
Afair it is like Justin assumed and the dependency management section was just not considered at all.
j
There is a dependencyManagement plugin that you can use to import BOMs: https://docs.spring.io/dependency-management-plugin/docs/current/reference/html/ its from spring but can be used totally independently from spring. older versions of it worked with gradle 1.x and 2.x
v
Yes, Justin already recommended that disease above. :-)