Inconsistent DSL for maven repositories and maven deployer

The following build:

apply {
    plugin 'java'
    plugin 'maven'
}
  repositories {
    maven {
        url = 'http://somerepo/nexus/content/repositories/snapshots'
    }
}
  uploadArchives {
    repositories {
        mavenDeployer {
            repository {
                url = 'file:///tmp/maven_repo'
            }
        }
    }
}

results in the following warning being printed out

Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "url" on "[]", value: "file:///tmp/maven_repo".

This also means that this does not delegate to the maven repository being configured with the closure, which can make the builds fail.

Changing the deployer configuratin to following works fine:

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: 'file:///tmp/maven_repo')
        }
    }
}

The DSL is inconsistent: dependency repositories can be configured with closures with setters, the deployer cannot.

We’re aware of these limitations and inconsistencies with the ‘uploadArchives’ way of publishing artifacts. To address this, we are adding an entirely new way of publishing artifacts from Gradle. These plugins are a work in progress, but in many cases will already produce a better result than the ‘old way’.

Check out the Ivy Publishing and Maven Publishing chapters of the user guide for more info.

I just came across this issue which is two weeks old.

Note that the warning is emitted because the url is not property but method in both cases. Just remove the equal sign and warning disappear.

Not really. I’m using 1.6 and when I change the ‘url’ from property to method call it fails:

A problem occurred evaluating root project 'test'.
> No signature of method: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer.url() is applicable for argument types: (java.lang.String) values: [file:///tmp/maven_repo]

I didn’t notice that you figured out the syntax in the second code snippet. So my advice is pointless and misleading. I am sorry.