Dependency management

Maven offers dependencyManagment:

http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

making it possible to set version used throughout a project in one pom file. What is the equivalent in gradle, I have looked at this:

http://gradle.org/docs/current/userguide/dependency_management.html

but I need to be able to setup dependencies without specifying versions (assuming they have been specified in eg. a common plugin/project).

AFAIK there is no dependency inheritance in Gradle. Gradle uses configuration injection instead, see Cross project configuration. You could define a list of dependencies in the root project and then re-use it when configuring each subproject, this way you will not have to specify a version more than once.

I’m assuming the question is in the context of a multi-project build?

Something that seems to be somewhat of a convention (the gradle source uses this in their build files) is to define some project extension properties on the root project, i.e. something like:

ext {
  log4jVersion = "1.2.17"
  groovyVersion = "2.0.5"
}

you can then either apply these to all subprojects in the same file:

//in the same build.gradle as the above ext definition
allprojects {
   apply plugin: 'groovy'
    dependencies {
     groovy
"org.codehaus.groovy:groovy:$groovyVersion"
    compile "log4j:log4j:$log4jVersion"
  }
}

or use them in a build.gradle for a specific sub project:

//<root>/subProjectA/build.gradle
  dependencies {
     groovy
"org.codehaus.groovy:groovy:$groovyVersion"
    compile "log4j:log4j:$log4jVersion"
  }

This is assuming that your various subprojects do not have the exact same dependencies, but differing subsets of the dependencies but you would always like for a specific dependency (like log4j above) to be fixed to a specific, globally configured version.