Mavin-plugin pom generator doesn't handle map gradle dynamic dependency correctly to maven dynamic dependency

For gradle dependencies like this: compile group: ‘org.slf4j’, name: ‘slf4j-simple’, version: ‘1.7.+’

the maven plugin maps it to:





But the contents of the version tag should look like this:



The code here: seems to copy the version info verbatim w/o checking for this case:

Gradle doesn’t do any mapping for version range syntax, but I believe that ‘1.7.+’ is also supported by Maven. Have you tried using ‘[1.7,)’ in the build script?

You mean in the build.gradle script? That’s the wrong syntax for gradle AFAIK.

If you try adding a maven dependency on the pom that’s generate, you get this error:

Could not find artifact org.slf4j:slf4j-api:jar:1.7.+ in central ( so that appears to be the wrong syntax. That’s why I linked this which describes the different syntaxes for their dynamic dependencies:

I’m trying to work around it by doing something like this but haven’t gotten it working yet:

pom.whenConfigured { generatedPom ->

generatedPom.dependencies.each { mavenDep ->

if (isDynamic(mavenDep)) {

println(‘processing’ + mavenDep)

mavenDep.version = ‘[’ + mavenDep.version.replaceAll(’+’,’,’) + ‘)’




ok…this seems to work ‘’’’ pom.whenConfigured { generatedPom ->

generatedPom.dependencies.each { mavenDep ->

if (isDynamic(mavenDep)) {

mavenDep.version = ‘[’ + mavenDep.version[0…-2] + ‘,)’



} boolean isDynamic(def dep) {

return dep.version.any { it == ‘[’ || it == ‘]’ || it == ‘(’ || it == ‘)’ || it == ‘+’ } } ‘’’’

This works fine for me:

dependencies {
    compile "org.slf4j:slf4j-api:[1.7,)"

PS: Please use HTML code tags for code snippets.

Thanks, Peter. Is this an officially support dynamic version syntax? The Gradle manual seems to specify the + syntax here and has no mention you can use the Maven syntax:

Gradle supports the same syntax as Ivy, which supports the Maven syntax. So I’d say it’s supported.

Thanks, Peter. Could you guys update the Gradle docs to include examples of this? Most people probably don’t know about it. I don’t think I’ve ever seen this syntax in any open source projects I’ve looked at…

Best way to get this fixed is to send a pull request.

This has since been fixed and will be released in Gradle 2.3. It will also be enforced for deployments to the Central Repository to avoid incompatibilities.