How can I use a dependencyManagement POM in Gradle?


(Robert Simmons) #1

In Maven there is a concept where one can put a section in the pom.xml and then refer to an artifact of type pom. What this will do is go fetch that pom and set the versions for all related jars to a particular product. For example:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.spec</groupId>
            <artifactId>jboss-javaee-6.0</artifactId>
            <version>3.0.0.Final</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>

Now if I use any artifact from that release of JBoss, I need not specify version but rather the POM imported will do the job for me.

How can I accomplish the same thing in gradle?


(Peter Niederwieser) #2

Gradle doesn’t currently support Maven BOMs (note the B). To share such information between multiple Gradle builds, you can write a script or binary plugin that declares a data structure (e.g. a map) containing the information.


(Emil Breding) #3

Hibernate did something similar to dependency management, have a look here: https://github.com/hibernate/hibernate-orm/blob/master/libraries.gradle