Failure applying a plugin because of class not found exception

buildscript {

repositories {

ivy {

url project.ivyRepoUrl

layout “gradle”

}

}

dependencies {

classpath group: ‘com.aa.aabuilds’, name: ‘gradle-aa-plugin’, version: ‘1.0.1’

} } apply plugin: ‘aaplugin’

Caused by: org.gradle.api.tasks.TaskInstantiationException: Could not create task of type ‘ArchiveArtifactsHelper’.

at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:126)

at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:121)

at org.gradle.api.internal.AbstractTask.injectIntoNewInstance(AbstractTask.java:138)

at org.gradle.api.internal.project.taskfactory.TaskFactory.createTaskObject(TaskFactory.java:121)

at org.gradle.api.internal.project.taskfactory.TaskFactory.createTask(TaskFactory.java:81)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory.createTask(AnnotationProcessingTaskFactory.java:99)

at org.gradle.api.internal.project.taskfactory.DependencyAutoWireTaskFactory.createTask(DependencyAutoWireTaskFactory.java:39)

at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:52)

at org.gradle.api.internal.project.AbstractProject.task(AbstractProject.java:871)

at org.gradle.api.Project$task$1.call(Unknown Source)

at com.aa.aabuilds.aaplugin.HdsPlugin.apply(AAPlugin.groovy:20)

at com.aa.aabuilds.aaplugin.HdsPlugin.apply(AAPlugin.groovy)

at org.gradle.api.internal.plugins.DefaultPluginContainer.providePlugin(DefaultPluginContainer.java:188)

at org.gradle.api.internal.plugins.DefaultPluginContainer.addPluginInternal(DefaultPluginContainer.java:137)

at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:103)

at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:115)

… 44 more Caused by: java.lang.NoClassDefFoundError: org/apache/http/HttpEntity

at com.hds.hdsbuilds.hdsplugin.ArchiveArtifactsHelper.(ArchiveArtifactsHelper.groovy:37)

at com.hds.hdsbuilds.hdsplugin.ArchiveArtifactsHelper_Decorated.(Unknown Source)

at org.gradle.api.internal.DependencyInjectingInstantiator.newInstance(DependencyInjectingInstantiator.java:48)

at org.gradle.api.internal.ClassGeneratorBackedInstantiator.newInstance(ClassGeneratorBackedInstantiator.java:36)

at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:124)

… 59 more Caused by: java.lang.ClassNotFoundException: org.apache.http.HttpEntity

… 64 more

I was successfully able to run the same task using a different version of gradle in a different project

Failure was for gradle version 2.2.1, success was for gradle 2.0

Actually, I was missing a classpath dependency that resolved my issue.