When I try the following code (just to check the classpath): Task testTask = project.tasks[‘test’]
println(testTask.getClasspath().getAsPath()); or for (File file : testTask.getClasspath().getFiles()) {
//do something
} I get an exception with cause: You can’t change a configuration which is not in unresolved state!
org.gradle.api.GradleScriptException: A problem occurred evaluating root project ‘bas’.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:127)
at org.gradle.configuration.BuildScriptProcessor.evaluate(BuildScriptProcessor.java:38)
at org.gradle.configuration.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:43)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:474)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:73)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:23)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:21)
at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:38)
at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:35)
at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:450)
at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:445)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:141)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)
at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:233)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:217)
at org.gradle.launcher.Main.doAction(Main.java:48)
at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53)
at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51)
at org.gradle.launcher.exec.Execution.execute(Execution.java:28)
at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39)
at org.gradle.launcher.Main.main(Main.java:39)
at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51)
at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33)
at org.gradle.launcher.GradleMain.main(GradleMain.java:24) Caused by: org.gradle.api.InvalidUserDataException: You can’t change a configuration which is not in unresolved state!
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.throwExceptionIfNotInUnresolvedState(DefaultConfiguration.java:455)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$500(DefaultConfiguration.java:47)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$VetoContainerChangeAction.run(DefaultConfiguration.java:555)
at org.gradle.api.internal.DefaultDomainObjectCollection.assertMutable(DefaultDomainObjectCollection.java:296)
at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:196)
at org.gradle.api.internal.DelegatingDomainObjectSet.add(DelegatingDomainObjectSet.java:100)
at org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.doAdd(DefaultDependencyHandler.groovy:66)
at org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.this$2$doAdd(DefaultDependencyHandler.groovy)
at org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler$_methodMissing_closure1.doCall(DefaultDependencyHandler.groovy: 105)
at org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.methodMissing(DefaultDependencyHandler.groovy:104)
at org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.invokeMethod(DefaultDependencyHandler.groovy)
at build_14nsphvvdc2jitql6u5e007osk$_run_closure3_closure16.doCall(C:\EclipseWorkspace\bas\build.gradle:135)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:136)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:85)
at org.gradle.api.internal.project.AbstractProject.dependencies(AbstractProject.java:880)
at build_14nsphvvdc2jitql6u5e007osk$_run_closure3.doCall(C:\EclipseWorkspace\bas\build.gradle:122)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:136)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:85)
at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:861)
at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:866)
at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:158)
at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:93)
at org.gradle.api.internal.project.DefaultProject_Decorated.invokeMethod(Unknown Source)
at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.groovy:72)
at build_14nsphvvdc2jitql6u5e007osk.run(C:\EclipseWorkspace\bas\build.gradle:85)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
… 30 more