Dynamically apply a plugin

Is there a way to dynamically apply a plugin based on some type of configuration? For example, I am trying to use the emma plugin and I really don’t want the developers to run the plugin every time they build but to have the continuous integration server to run it. I was trying to do the following:

if (hasProperty('emma')) {
 buildscript {
  dependencies {
   classpath files('repo/gradle-emma-plugin-0.1.jar')
  }
 }
    apply plugin: 'emma'
}

But the emma plugin is never found…What am I doing wrong and is there a better way of doing this?