Converter for pom.xml into build.gradle

summary: Provide a converter to turn a pom.xml into a native Gradle build file. status: Planned Soon code: planned

A first implementation in this direction already exist by the Maven Converter Plugin. We want to merge the basic functionality into the Gradle core and evolve it step by step from there.

This would be a great learning tool for people new to Gradle, like myself. I would also minimize the rather high barrier of converting existing Maven projects to Gradle.

Awesome!

Can the POM be used without conversion as dependent Maven projects may not be internal projects.

Can’t wait for this :slight_smile:

Is this on the roadmap for 1.2 ?

A basic version is planned for 1.2. This would amongst other things ignore any custom Maven plugins but will be nonetheless a great help, if just for not manually converting the dependency notations.

+1

It would be great!

Using gradle 1.4, I just tried to convert the maven pom.xml to gradle, but it fails.

I followed the steps at http://www.gradle.org/docs/current/userguide/bootstrap_plugin.html#N140DF

pom.xml: http://pastebin.com/AVahZjZF

Error log at: http://pastebin.com/FLKh6kQq

I tried maven2gradle & setupBuild, just want to convert pom to gradle. Not work for me.

So I worked out a tool to help me convert 20+ maven projects to gradle. that works fine for me.

I’ll move my code into github later.

Post the URL of the project when you move it to Github

Hello Wang, can you eloborate on the problems you had when using gradle init (former setupBuild)? cheers, René

Hi, Rene,

I tried “gradle setupBuild” with gradle-1.7, it failed with my projects(multiple one). I just tried with gradle-1.9, “gradle init” works fine for my case, great job!

Just some comments for the conversion results:

  1. It’s better to have libraries.gradle to manage those dependencies in “dependencyManagement” section. That would be cleaner for developers. I had those logic in my tool, not sure whether git init need it, if it is, I can provide patch for git init.

  2. I saw settings.gradle include additional infos for project dependencies, are those info necessary?

At least, for gradle 1.7, only include those “project modules”, that file is clearer.

  1. add for gradle base on maven’s , that’s great. but my question is: maven might have scattered to exclude one specific dependency. That’s not good. “git init” could be smarter, if found there are multiple for one dependency, might provide a central/clearer way to exclude that dependency.

cheers, Simon

I just converted a pom to a build.gradle with ‘gradle init --type pom’ using Gradle 1.11, and I can’t force it to actually build the project. Everytime I run ‘gradle clean build’, it says everything is UP-TO-DATE:

$ gradle clean build

:clean

:compileJava UP-TO-DATE

:processResources UP-TO-DATE

:classes UP-TO-DATE

:jar

:assemble

:compileTestJava UP-TO-DATE

:processTestResources UP-TO-DATE

:testClasses UP-TO-DATE

:test UP-TO-DATE

:check UP-TO-DATE

:build

BUILD SUCCESSFUL

Total time: 5.316 secs

It also never runs my tests if I run ‘gradle cleanTest test’. I’ve changed files, changed the build dependencies, etc, and can’t get anything to make it build with Gradle. What can I do to make it actually build?