Dmitry Avtonomov
Dmitry Avtonomov

Reputation: 9489

Share dependency versions between Maven (pom.xml) and Gradle (build.gradle)

I have projects built by Maven and Gradle. Is there a way to define dependency versions in a text file, e.g.:

.
|-- dep-versions.properties
|
|-- proj-by-gradle
|   |-- build.gradle
|   `-- settings.gradle
|
`-- proj-by-maven
    `-- pom.xml

Is there an easy way to specify in dep-versions.properties, something like:

com.google.guava:guava = 26.0-jre
org.apache.commons:commons-pool2 = 2.5.0

And then use these versions in both the pom.xml and build.gradle?

Upvotes: 2

Views: 260

Answers (1)

Rene Groeschke
Rene Groeschke

Reputation: 28653

You can create a BOM pom (Bill of materials) and use it in both builds. Support for importing maven BOM files was added to Gradle in version 4.6: https://docs.gradle.org/4.6/release-notes.html#bom-import

Upvotes: 2

Related Questions