maven2Gradle task in Gradle 1.6-rc1

(Benjamin Muschko) #1


I was trying out the build setup plugin in Gradle 1.6-rc1 to generate a Maven POM via the maven2Gradle task. The current directory contains a pom.xml with the following content:

<project xmlns=""

When I run the gradle tasks the only task presented is this one:

Build Setup tasks
setupBuild - Initializes a new Gradle build. [incubating]

Based on the design doc shouldn’t the build setup provide the maven2Gradle task or am I missing something?



(René Groeschke) #2

The maven2Gradle task depends on the setupBuild task. you should see the task when running gradle tasks --all

cheers, René

(Benjamin Muschko) #3

Thanks, that works! I had already tried out the task with an earlier version of Gradle. I know that the task is at an early stage of development. Two things stood out in the generated pom.xml that might be a bug.

  1. If a description or no description is provided in the POM, an empty multi-line String is added.
description = """"""
  1. The generated repositories configuration block looks like this:
repositories {
       mavenRepo url: "http://someRepo"

Shouldn’t this be:

repositories {

Any ideas?

(René Groeschke) #4

thanks for pointing this out. The maven2Gradle converter uses the mavenRepo syntax when a repository is explicitly declared in the pom. Otherwise the mavenCentral() shortcut notation is used. I have to doublecheck how the description is generated. After a first view the name property of the effective pom is used as description.

cheers, René

(Peter Niederwieser) #5

Would probably be better to use the new ‘maven’ instead of the old ‘mavenRepo’ syntax.

(René Groeschke) #6

agreed. I thought, the ‘mavenRepo’ syntax is deprecated, but from what I can see, this isn’t the case.

(Benjamin Muschko) #7

Ah, I get it. The converter was using the repository URL defined in my Maven profile in ~/.m2/settings.xml.