2.3 Migration, error with repositories

I’m upgrading from Gradle 2.0 to Gradle 2.3, I’ve taken care of most of the issues that came up in my build scripts, but there is one error I can’t seem to figure out.

What went wrong:
A problem occurred configuring root project 'netsim'.
> The following model rules are unbound:
    model.repositories
      Mutable:
        - repositories (java.lang.Object)

Below is my build.gradle…at least the one in the root directory, it’s the only one that I have defined repositories.

allprojects {
  model {
    repositories {
        libs(PrebuiltLibraries) {
            boost {
                headers.srcDir "/usr/local/lib"
            }
            boost_system {
                binaries.withType(StaticLibraryBinary) {
                  def libName = 'libboost_system.a'
                  staticLibraryFile = file("/usr/local/lib/${libName}")
                }
            }
            boost_thread {
                binaries.withType(StaticLibraryBinary) {
                  def libName = 'libboost_thread.a'
                  staticLibraryFile = file("/usr/local/lib/${libName}")
                }
            }
            poco {
                headers.srcDir "/usr/local/lib"
            }
            PocoUtil {
                binaries.withType(StaticLibraryBinary) {
                  def libName = 'libPocoUtil.a'
                  staticLibraryFile = file("/usr/local/lib/${libName}")
                }
            }
            PocoNet {
                binaries.withType(StaticLibraryBinary) {
                  def libName = 'libPocoNet.a'
                  staticLibraryFile = file("/usr/local/lib/${libName}")
                }
            }
            PocoFoundation {
                binaries.withType(StaticLibraryBinary) {
                  def libName = 'libPocoFoundation.a'
                  staticLibraryFile = file("/usr/local/lib/${libName}")
                }
            }
            PocoXML {
                binaries.withType(StaticLibraryBinary) {
                  def libName = 'libPocoXML.a'
                  staticLibraryFile = file("/usr/local/lib/${libName}")
                }
            }
        }
    }
  }
}

class VersioningPlugin implements Plugin<Project> {
  void apply (Project project) {
    project.extensions.create ("versioning", VersioningPluginExtension)
    project.task ('version') << {
      println project.versioning.major + '.' + project.versioning.minor + '.' + project.versioning.build
    }
  }
}

class VersioningPluginExtension {
  String major
  String minor
  String build
}

project (":radio_fixture")
{
  apply plugin: "cpp"
  apply plugin: VersioningPlugin

  evaluationDependsOn (":application_framework")
  evaluationDependsOn (":radio_fixture:radio")

  def makeVersion = versionMajor.isNumber () && versionMinor.isNumber () && versionBuild.isNumber ()
  if (makeVersion) {
    versioning {
      if (System.env.BUILD_NUMBER != null) {
        versionBuild = System.env.BUILD_NUMBER
      }
      major = versionMajor
      minor = versionMinor
      build = versionBuild
    }
  }

  model {
    components {
      main (NativeExecutableSpec) {
        sources {
          main
          {
            cpp
            {
              lib project: ':radio_fixture:radio', library: 'main', linkage: 'static'
              lib project: ':application_framework', library: 'main', linkage: 'static'
              lib library: 'poco', linkage: 'api'
              lib library: 'PocoUtil', linkage: 'static'
              lib library: 'PocoNet', linkage: 'static'
              lib library: 'PocoXML', linkage: 'static'
              lib library: 'PocoFoundation', linkage: 'static'
              lib library: 'boost', linkage: 'api'
              lib library: 'boost_system', linkage: 'static'
              lib library: 'boost_thread', linkage: 'static'
            }
          }
        }
      }
    }
  }

  binaries.all {
    cppCompiler.args "-g"
    cppCompiler.args "-Wall"
    cppCompiler.define "POCO_STATIC"
    def linkerArgs  = '-lPocoUtil -lPocoNet -lPocoFoundation -lboost_thread -lboost_system -lstdc++ -lpthread -lrt'
    if (makeVersion) {
      linkerArgs += ' -Xlinker --defsym -Xlinker __VERSION_MAJOR=' + project.versioning.major
      linkerArgs += ' -Xlinker --defsym -Xlinker __VERSION_MINOR=' + project.versioning.minor
      linkerArgs += ' -Xlinker --defsym -Xlinker __VERSION_BUILD=' + project.versioning.build
    }
    def linkerArgsList = linkerArgs.tokenize (' ') as String []
    linker.args linkerArgsList
  }
}

task wrapper(type: Wrapper) {
  gradleVersion = '2.3'
}

You probably want to use subprojects instead of allprojects. It’s complaining that there is no repositories element for the root project which would make sense if it doesn’t have the native plugins applied to it.

@luke_daley, I moved repositories down to the specific project. Thanks for your help, that solved it.