Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot execute null+configuration #297

Closed
boris-petrov opened this issue May 10, 2017 · 25 comments
Closed

Cannot execute null+configuration #297

boris-petrov opened this issue May 10, 2017 · 25 comments
Labels
Milestone

Comments

@boris-petrov
Copy link

Gradle version is 3.4.1. With the following (part of) build.gradle:

plugins {
	id 'com.github.johnrengelman.shadow' version '2.0.0'
	id 'me.champeau.gradle.jmh' version '0.3.1'
}

apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'me.champeau.gradle.jmh'

I get:

An exception occurred applying plugin request [id: 'me.champeau.gradle.jmh', version: '0.3.1']
> Failed to apply plugin [id 'me.champeau.gradle.jmh']
   > Cannot execute null+configuration ':backend:shadow'

This didn't happen with 1.2.4. I've no idea what that error is or how to debug it. Please advise. :)

@SlyDen
Copy link

SlyDen commented May 10, 2017

I got the similar error for Ratpack framework ... shadow 1.2.4 works fine with same version

An exception occurred applying plugin request [id: 'io.ratpack.ratpack-groovy', version: '1.5.0-rc-2']
> Failed to apply plugin [class 'org.gradle.api.plugins.GroovyBasePlugin']
   > Cannot execute null+configuration ':shadow'

@wmacgyver
Copy link

I too got the

> Failed to apply plugin [class 'org.gradle.api.plugins.GroovyBasePlugin']
   > Cannot execute null+configuration ':shadow'

@sureshg
Copy link

sureshg commented May 10, 2017

Same here for Gradle Script Kotlin

An exception occurred applying plugin request [id: 'org.jetbrains.kotlin.jvm', version: '1.1.2-2']
> Failed to apply plugin [id 'org.jetbrains.kotlin.jvm']
   > Cannot execute null+configuration ':shadow'

@johnrengelman
Copy link
Collaborator

@boris-petrov is that all that's in the build.gradle file? I need to the simplest version of a project that exhibits the problem.

@johnrengelman
Copy link
Collaborator

and can someone post a full stack trace by running the build with -s?

@boris-petrov
Copy link
Author

@johnrengelman - my build.gradle file is 860 lines of code and it's going to be really difficult to narrow down the problem. I could try if nothing else works. Here's a full stacktrace:

Download https://jcenter.bintray.com/com/github/jengelman/gradle/plugins/shadow/2.0.0/shadow-2.0.0.jar

FAILURE: Build failed with an exception.

* Where:
Build file '/home/boris/project/backend/build.gradle' line: 14

* What went wrong:
An exception occurred applying plugin request [id: 'me.champeau.gradle.jmh', version: '0.3.1']
> Failed to apply plugin [id 'me.champeau.gradle.jmh']
   > Cannot execute null+configuration ':backend:shadow'

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.plugins.InvalidPluginException: An exception occurred applying plugin request [id: 'me.champeau.gradle.jmh', version: '0.3.1']
        at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugin(DefaultPluginRequestApplicator.java:224)
        at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugins(DefaultPluginRequestApplicator.java:171)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:156)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:39)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
        at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:70)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.access$000(LifecycleProjectEvaluator.java:33)
        at org.gradle.configuration.project.LifecycleProjectEvaluator$1.execute(LifecycleProjectEvaluator.java:53)
        at org.gradle.configuration.project.LifecycleProjectEvaluator$1.execute(LifecycleProjectEvaluator.java:50)
        at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:50)
        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:599)
        at org.gradle.api.internal.project.DefaultProject.evaluationDependsOn(DefaultProject.java:670)
        at org.gradle.api.internal.project.DefaultProject.evaluationDependsOnChildren(DefaultProject.java:653)
        at org.gradle.api.Project$evaluationDependsOnChildren$2.call(Unknown Source)
        at build_byfewhyvli0qkzef75dvps2cc$_run_closure9.doCall(/home/boris/project/build.gradle:169)
        at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:70)
        at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:160)
        at org.gradle.util.ConfigureUtil.configureSelf(ConfigureUtil.java:136)
        at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:528)
        at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:78)
        at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:104)
        at org.gradle.api.internal.DefaultNamedDomainObjectCollection$ContainerElementsDynamicObject.invokeMethod(DefaultNamedDomainObjectCollection.java:372)
        at org.gradle.internal.metaobject.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:96)
        at org.gradle.internal.metaobject.MixInClosurePropertiesAsMethodsDynamicObject.invokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:30)
        at org.gradle.groovy.scripts.BasicScript.invokeMethod(BasicScript.java:111)
        at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:120)
        at build_byfewhyvli0qkzef75dvps2cc.run(/home/boris/project/build.gradle:149)
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:176)
        at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:181)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:39)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
        at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:70)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.access$000(LifecycleProjectEvaluator.java:33)
        at org.gradle.configuration.project.LifecycleProjectEvaluator$1.execute(LifecycleProjectEvaluator.java:53)
        at org.gradle.configuration.project.LifecycleProjectEvaluator$1.execute(LifecycleProjectEvaluator.java:50)
        at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:50)
        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:599)
        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:125)
        at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35)
        at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:60)
        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:38)
        at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuildAction.execute(DefaultGradleLauncher.java:233)
        at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuildAction.execute(DefaultGradleLauncher.java:230)
        at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:160)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:102)
        at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:49)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:31)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:46)
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'me.champeau.gradle.jmh']
        at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:155)
        at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:112)
        at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator$5.run(DefaultPluginRequestApplicator.java:174)
        at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugin(DefaultPluginRequestApplicator.java:212)
        ... 93 more
Caused by: java.lang.NullPointerException: Cannot execute null+configuration ':backend:shadow'
        at org.gradle.api.file.FileCollection$plus$0.call(Unknown Source)
        at com.github.jengelman.gradle.plugins.shadow.ShadowJavaPlugin$_apply_closure1.doCall(ShadowJavaPlugin.groovy:35)
        at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:70)
        at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:160)
        at org.gradle.util.ConfigureUtil.configureSelf(ConfigureUtil.java:136)
        at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:528)
        at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:78)
        at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:104)
        at org.gradle.util.ConfigureUtil$1.execute(ConfigureUtil.java:123)
        at org.gradle.internal.Actions$FilteredAction.execute(Actions.java:205)
        at org.gradle.listener.ActionBroadcast.execute(ActionBroadcast.java:39)
        at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:203)
        at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:197)
        at org.gradle.api.internal.DefaultNamedDomainObjectCollection.add(DefaultNamedDomainObjectCollection.java:94)
        at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:93)
        at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:111)
        at org.gradle.api.plugins.JavaBasePlugin.createCompileJavaTaskForBinary(JavaBasePlugin.java:164)
        at org.gradle.api.plugins.JavaBasePlugin.access$300(JavaBasePlugin.java:80)
        at org.gradle.api.plugins.JavaBasePlugin$1.execute(JavaBasePlugin.java:143)
        at org.gradle.api.plugins.JavaBasePlugin$1.execute(JavaBasePlugin.java:133)
        at org.gradle.listener.ActionBroadcast.execute(ActionBroadcast.java:39)
        at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:203)
        at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:197)
        at org.gradle.api.internal.DefaultNamedDomainObjectCollection.add(DefaultNamedDomainObjectCollection.java:94)
        at org.gradle.api.internal.AbstractNamedDomainObjectContainer.create(AbstractNamedDomainObjectContainer.java:63)
        at org.gradle.api.internal.AbstractNamedDomainObjectContainer.create(AbstractNamedDomainObjectContainer.java:57)
        at org.gradle.api.internal.NamedDomainObjectContainerConfigureDelegate._configure(NamedDomainObjectContainerConfigureDelegate.java:40)
        at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:68)
        at me.champeau.gradle.JMHPlugin$_apply_closure2.doCall(JMHPlugin.groovy:56)
        at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:70)
        at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:160)
        at org.gradle.util.ConfigureUtil.configureSelf(ConfigureUtil.java:148)
        at org.gradle.api.internal.AbstractNamedDomainObjectContainer.configure(AbstractNamedDomainObjectContainer.java:74)
        at org.gradle.api.internal.AbstractNamedDomainObjectContainer.configure(AbstractNamedDomainObjectContainer.java:29)
        at org.gradle.api.plugins.JavaPluginConvention.sourceSets(JavaPluginConvention.java:90)
        at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:464)
        at org.gradle.internal.metaobject.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:176)
        at org.gradle.api.internal.plugins.DefaultConvention$ExtensionsDynamicObject.invokeMethod(DefaultConvention.java:220)
        at org.gradle.internal.metaobject.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:96)
        at org.gradle.internal.metaobject.MixInClosurePropertiesAsMethodsDynamicObject.invokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:30)
        at org.gradle.internal.metaobject.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:163)
        at org.gradle.api.internal.project.DefaultProject_Decorated.invokeMethod(Unknown Source)
        at me.champeau.gradle.JMHPlugin.apply(JMHPlugin.groovy:55)
        at me.champeau.gradle.JMHPlugin.apply(JMHPlugin.groovy)
        at org.gradle.api.internal.plugins.ImperativeOnlyPluginApplicator.applyImperative(ImperativeOnlyPluginApplicator.java:35)
        at org.gradle.api.internal.plugins.RuleBasedPluginApplicator.applyImperative(RuleBasedPluginApplicator.java:43)
        at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:139)
        ... 96 more


BUILD FAILED

Total time: 12.511 secs

@wmacgyver
Copy link

wmacgyver commented May 12, 2017

I reduced my build.gradle to this, and the problem still occures

plugins {
    id 'java'
    id 'groovy'
    id 'application'
    id 'com.github.johnrengelman.shadow' version '2.0.0'
    id 'net.ltgt.apt' version '0.10'
}

version = '1.0'
mainClassName = 'com.hello'

def compatibilityVersion = 1.8
sourceCompatibility = compatibilityVersion
targetCompatibility = compatibilityVersion

repositories {
    mavenCentral()
    jcenter()
}

dependencies {
    compile 'org.codehaus.groovy:groovy-all:2.4.11'
    compileOnly "com.google.auto.value:auto-value:$autoValueVersion"
    apt "com.google.auto.value:auto-value:$autoValueVersion"
    compileOnly 'com.google.code.findbugs:jsr305:3.0.1'

    testCompile 'org.spockframework:spock-core:1.1-groovy-2.4'

}

compileJava {
    options.compilerArgs << "-Xlint:unchecked"
}

shadowJar {
    archiveName = "shadowBug.${extension}"
}

running gradle shadow gets the following

  • What went wrong:
    An exception occurred applying plugin request [id: 'groovy']

Failed to apply plugin [class 'org.gradle.api.plugins.GroovyBasePlugin']
Cannot execute null+configuration ':shadow'

@johnrengelman
Copy link
Collaborator

Thanks. Will take a look soon.

@johnrengelman
Copy link
Collaborator

Ok, so it is related to order. First you don't know both java and groovy applied. groovy implies java.
So removing java will fix it, also putting groovy before java fixes it.
There definitely is a problem here with shadow, but that should get you moving for now.

@johnrengelman johnrengelman added this to the 2.0.1 milestone May 12, 2017
@wmacgyver
Copy link

wmacgyver commented May 13, 2017

thank you very much! yes, I can confirm removing java in that list of plugins fixed it

@CharlieKuharski
Copy link

Thanks!

@bjkeller
Copy link

Gradle 3.5.

I'm also getting this error, but it seems to be related to configuring sourceSets.

There are two subprojects and a main project. I can configure the subprojects to use the plugin independently, but the main project script has the null+configuration failure.

This is the minimal failing script:

plugins {
  id 'com.github.johnrengelman.shadow' version '2.0.0'
  id 'java'
}

sourceSets {
  exercisedTest
}

The stack trace is similar to the one above:

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/bjkeller/Documents/projects/testgen/working/randoop-master/build.gradle' line: 7

* What went wrong:
A problem occurred evaluating root project 'randoop-master'.
> Cannot execute null+configuration ':shadow'

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'randoop-master'.
	at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:92)
	at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:176)
	at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77)
	at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:181)
	at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:39)
	at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
	at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
	at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:70)
	at org.gradle.configuration.project.LifecycleProjectEvaluator.access$000(LifecycleProjectEvaluator.java:33)
	at org.gradle.configuration.project.LifecycleProjectEvaluator$1.execute(LifecycleProjectEvaluator.java:53)
	at org.gradle.configuration.project.LifecycleProjectEvaluator$1.execute(LifecycleProjectEvaluator.java:50)
	at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
	at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:50)
	at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:648)
	at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:126)
	at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35)
	at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:60)
	at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:38)
	at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuildAction.execute(DefaultGradleLauncher.java:207)
	at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuildAction.execute(DefaultGradleLauncher.java:204)
	at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:146)
	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:95)
	at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:66)
	at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
	at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
	at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
	at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
	at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
	at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
	at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:49)
	at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:31)
	at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
	at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
	at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
	at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
	at org.gradle.util.Swapper.swap(Swapper.java:38)
	at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
	at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
	at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
	at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
	at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
	at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:46)
Caused by: java.lang.NullPointerException: Cannot execute null+configuration ':shadow'
	at org.gradle.api.file.FileCollection$plus$0.call(Unknown Source)
	at com.github.jengelman.gradle.plugins.shadow.ShadowJavaPlugin$_apply_closure1.doCall(ShadowJavaPlugin.groovy:35)
	at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:71)
	at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:160)
	at org.gradle.util.ConfigureUtil.configureSelf(ConfigureUtil.java:136)
	at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:584)
	at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:79)
	at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:104)
	at org.gradle.util.ConfigureUtil$1.execute(ConfigureUtil.java:123)
	at org.gradle.internal.Actions$FilteredAction.execute(Actions.java:205)
	at org.gradle.internal.ImmutableActionSet$CompositeSet.execute(ImmutableActionSet.java:196)
	at org.gradle.internal.MutableActionSet.execute(MutableActionSet.java:35)
	at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:204)
	at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:198)
	at org.gradle.api.internal.DefaultNamedDomainObjectCollection.add(DefaultNamedDomainObjectCollection.java:94)
	at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:93)
	at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:111)
	at org.gradle.api.plugins.JavaBasePlugin.createCompileJavaTaskForBinary(JavaBasePlugin.java:164)
	at org.gradle.api.plugins.JavaBasePlugin.access$300(JavaBasePlugin.java:80)
	at org.gradle.api.plugins.JavaBasePlugin$1.execute(JavaBasePlugin.java:143)
	at org.gradle.api.plugins.JavaBasePlugin$1.execute(JavaBasePlugin.java:133)
	at org.gradle.internal.ImmutableActionSet$CompositeSet.execute(ImmutableActionSet.java:196)
	at org.gradle.internal.MutableActionSet.execute(MutableActionSet.java:35)
	at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:204)
	at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:198)
	at org.gradle.api.internal.DefaultNamedDomainObjectCollection.add(DefaultNamedDomainObjectCollection.java:94)
	at org.gradle.api.internal.AbstractNamedDomainObjectContainer.create(AbstractNamedDomainObjectContainer.java:68)
	at org.gradle.api.internal.AbstractNamedDomainObjectContainer.create(AbstractNamedDomainObjectContainer.java:62)
	at org.gradle.api.internal.NamedDomainObjectContainerConfigureDelegate._configure(NamedDomainObjectContainerConfigureDelegate.java:40)
	at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:68)
	at build_7hiy0667yi81l7sb1r2m77d10$_run_closure1.doCall(/Users/bjkeller/Documents/projects/testgen/working/randoop-master/build.gradle:7)
	at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:71)
	at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:160)
	at org.gradle.util.ConfigureUtil.configureSelf(ConfigureUtil.java:148)
	at org.gradle.api.internal.AbstractNamedDomainObjectContainer.configure(AbstractNamedDomainObjectContainer.java:79)
	at org.gradle.api.internal.AbstractNamedDomainObjectContainer.configure(AbstractNamedDomainObjectContainer.java:34)
	at org.gradle.api.plugins.JavaPluginConvention.sourceSets(JavaPluginConvention.java:93)
	at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:464)
	at org.gradle.internal.metaobject.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:176)
	at org.gradle.api.internal.plugins.DefaultConvention$ExtensionsDynamicObject.invokeMethod(DefaultConvention.java:308)
	at org.gradle.internal.metaobject.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:96)
	at org.gradle.internal.metaobject.MixInClosurePropertiesAsMethodsDynamicObject.invokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:30)
	at org.gradle.groovy.scripts.BasicScript.invokeMethod(BasicScript.java:107)
	at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:116)
	at build_7hiy0667yi81l7sb1r2m77d10.run(/Users/bjkeller/Documents/projects/testgen/working/randoop-master/build.gradle:6)
	at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90)
	... 62 more

@melix
Copy link
Contributor

melix commented May 24, 2017

Same error here: adding a source set will trigger the problem.

@johnrengelman
Copy link
Collaborator

My plan is to get to this is this weekend.
@melix any idea on why the classpath wouldn't be set on a SourceSet? This line seems very innocuous - https://github.com/johnrengelman/shadow/blob/master/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.groovy#L35

@melix
Copy link
Contributor

melix commented May 26, 2017

@johnrengelman if you do this, you're basically overwriting the default classpath. I think it's not the right way to do. classpath should be null in most of the cases, to let Gradle define it by convention. It's especially true with variant aware dependency management. Instead, you should use configurations and not try to tweak the effective classpath.

Look at: https://github.com/gradle/gradle/blob/1ccaad23542778c76deec247cb8167d778768d6c/subprojects/plugins/src/main/java/org/gradle/api/plugins/JavaBasePlugin.java#L274-L279

This is how the compile classpath of a source set is effectively set. So as a first fix, I would change your plugin to tell that the compileClasspath configuration extends from shadow (and runtimeClasspath too).

After that, I think it would be valuable to add stronger modelling, just like the java-library does, to separate what dependencies need to be shadowed for compile (and this is likely implementation dependencies), and those which need to be shadowed at runtime only. /cc @oehme

@oehme
Copy link

oehme commented May 26, 2017

any idea on why the classpath wouldn't be set on a SourceSet?

That's a compile task, not a sourceSet. Compile tasks are configured by convention and you generally shouldn't need to touch them to add more dependencies. Instead, as @melix pointed out, you should use compileClasspath.extendsFrom(shadow).

melix added a commit to melix/jmh-gradle-plugin that referenced this issue Jun 1, 2017
Note that this version would only be compatible with Gradle 4.0+ and Shadow plugin 2.0+. It makes use of the new
worker API, which avoids us doing all the nasty jar repackaging of the runtime of JMH: a worker process is automatically
spawned by Gradle with the appropriate classpath. This means that we can compile this plugin with a specific version
of JMH, but the user can override the version, and we would still use the `Main` entry point instead of an exec task
to execute the benchmarks.

This commit also fixes the [warning issued by Gradle 4.0](#94), which is the main reason for broken compatibility with
released under 4.0: the newer API doesn't exist on 3.5.

This commit however breaks a test with the shadow plugin, and is waiting for the resolution of [this bug](GradleUp/shadow#297).
Choonster added a commit to Choonster-Minecraft-Mods/TestMod3 that referenced this issue Jun 12, 2017
-- Can't update to Shadow 2.0.0 due to GradleUp/shadow#297
@davidm-public
Copy link

+1, though solved, by ordering plugins

Switching from 1.2.4 to 2.0.0 with plugins in this order:

apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'groovy'

Results in:

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/davem/Auctionologies/repository/AuctionSoftware/au-2016/codebase/apps/groovy/groovy-server/build.gradle' line: 16

* What went wrong:
A problem occurred evaluating root project 'groovy-server'.
> Failed to apply plugin [class 'org.gradle.api.plugins.GroovyBasePlugin']
   > Cannot execute null+configuration ':shadow'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

However, the build succeeds if the plugins are reordered:

apply plugin: 'groovy'
apply plugin: 'com.github.johnrengelman.shadow'

@melix
Copy link
Contributor

melix commented Jun 19, 2017

@johnrengelman do you have any ETA on this bugfix? The JMH plugin is basically blocked on it.

@johnrengelman
Copy link
Collaborator

@melix trying to find the time to dig into it.

You're suggestions above wouldn't work for shadow. It would cause those dependencies to be merged into the final jar, which is not the intent of the shadow configuration (those dependencies effectively become the your new runtime dependencies after the JAR merging is completed).

The intent was to automatically wire the compilation tasks with the shadow dependencies in the classpath so you could still compile against them.

@johnrengelman
Copy link
Collaborator

johnrengelman commented Jun 23, 2017

@melix nevermind on my comment above - i misread what you wrote. Ok, let me try the comileClasspath thing.

johnrengelman pushed a commit that referenced this issue Jun 23, 2017
@johnrengelman
Copy link
Collaborator

This is fixed in 2.0.1 which is now available.

@melix
Copy link
Contributor

melix commented Jun 23, 2017

Excellent, thank you!

@wmacgyver
Copy link

thank you very much!

@jfrosch
Copy link

jfrosch commented Jun 24, 2017

Thanks for fixing this issue John. I use Gradle, but don't really want to become a Gradle developer just to use it. Weird Gradle-related errors are just annoying. :-)

@sahoosunilkumar
Copy link

I am facing same issue for android. I haven't applied java, groovy plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests