Search code examples
mavengradlepom.xmlparent-pommaven-bom

Parent pom usage in build.gradle


I have a need to convert the maven project to gradle project. All is going fine, but there is one problem that I faced, in the current project we are using dependency management throw parent pom of maven and in gradle as long as I researched there is no possibility to do so. I was thinking to convert somehow parent pom to maven bom and use in build.gradle because I know that gradle can use maven boms.

Do anyone have better ideas how to accoplish that ? Or may be someone also had this kind of problem, can suggest best ways to do it ?

Regards


Solution

  • You could use my gradle-maven-transform plugin to transform your pom.xmls into gradle scripts.

    You can use the DependencyAggregator to find versions which are common across all projects and generate a root build.gradle containing the common versions.

    Each project script can then reference a version variable from the root project instead of hard coding

    You might choose to use nebula dependency recomnender plugin to manage common versions. The maven-transform plugin can generate scripts to support this style of declaration too

    Whilst you are evaluating the gradle build you "apply" the generated gradle scripts in your gradle build. During this time both maven and gradle builds will work in parallel. Once your happy with the gradle build you copy paste the generated scripts into your build.gradle files and ditch maven for ever! Yay!