Eclipse plugin broken with 2.0-rc-1


(Liyu Wang) #1

Seems the eclipse plugin in the 2.0-rc-1 is broken, I have the following snip in my build.gradle. it was working fine with 1.12: eclipse .classpath {

plusConfigurations += configurations.loadtestRuntime }

with 2.0-rc-1, it reports:

java.io.File cannot be cast to org.gradle.api.artifacts.Configuration

any idea?


(Radim Kubacki) #2

I am not able to reproduce this yet but it looks similar to http://issues.gradle.org/browse/GRADLE-3101

Can you create a simple reproducible test case for this?


(Liyu Wang) #3

I figured out, event for a single configuration, I have to use [] to wrap it. so if I do eclipse.classpath.plusConfigurations += [configurations.loadtestRuntime], it will be fine in 2.0-rc-1.


(m.ruegamer) #4

I get the same ClassCastException when using “Gradle / Refresh Source Folders” in the context menu of a project in eclipse. Maybe it is more en eclipse problem than a gradle issue.

org.gradle.tooling.GradleConnectionException: Could not fetch model of type 'HierarchicalEclipseProject' using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.0-rc-1-bin.zip'.
 at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:55)
 at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
 at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:745)
 at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
 at org.gradle.tooling.internal.consumer.DefaultModelBuilder.get(DefaultModelBuilder.java:48)
 at org.springsource.ide.eclipse.gradle.core.GradleModelProvider.buildModel(GradleModelProvider.java:385)
 at org.springsource.ide.eclipse.gradle.core.GradleModelProvider$GroupedModelProvider.ensureModels(GradleModelProvider.java:290)
 at org.springsource.ide.eclipse.gradle.core.GradleProject.getGradleModel(GradleProject.java:633)
 at org.springsource.ide.eclipse.gradle.core.GradleProject.getSkeletalGradleModel(GradleProject.java:654)
 at org.springsource.ide.eclipse.gradle.core.GradleProject.refreshSourceFolders(GradleProject.java:199)
 at org.springsource.ide.eclipse.gradle.ui.actions.RefreshSourceFoldersAction$1.doit(RefreshSourceFoldersAction.java:41)
 at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable$1.run(GradleRunnable.java:49)
 at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.lang.ClassCastException: java.io.File cannot be cast to org.gradle.api.artifacts.Configuration
 at org.gradle.plugins.ide.internal.IdeDependenciesExtractor.extractProjectDependencies(IdeDependenciesExtractor.java:52)
 at org.gradle.plugins.ide.internal.IdeDependenciesExtractor$extractProjectDependencies.call(Unknown Source)
 at org.gradle.plugins.ide.eclipse.model.internal.ClasspathFactory$3.update(ClasspathFactory.groovy:45)
 at org.gradle.plugins.ide.eclipse.model.internal.ClasspathEntryBuilder$update.call(Unknown Source)
 at org.gradle.plugins.ide.eclipse.model.internal.ClasspathFactory.createEntries(ClasspathFactory.groovy:76)
 at org.gradle.plugins.ide.eclipse.model.internal.ClasspathFactory$createEntries.call(Unknown Source)
 at org.gradle.plugins.ide.eclipse.model.EclipseClasspath.resolveDependencies(EclipseClasspath.groovy:209)
 at org.gradle.plugins.ide.internal.tooling.EclipseModelBuilder.populate(EclipseModelBuilder.java:85)
 at org.gradle.plugins.ide.internal.tooling.EclipseModelBuilder.populate(EclipseModelBuilder.java:128)
 at org.gradle.plugins.ide.internal.tooling.EclipseModelBuilder.buildAll(EclipseModelBuilder.java:61)
 at org.gradle.plugins.ide.internal.tooling.EclipseModelBuilder.buildAll(EclipseModelBuilder.java:32)
 at org.gradle.tooling.internal.provider.BuildModelAction.run(BuildModelAction.java:68)
 at org.gradle.tooling.internal.provider.BuildModelAction.run(BuildModelAction.java:32)
 at org.gradle.tooling.internal.provider.ConfiguringBuildAction.run(ConfiguringBuildAction.java:143)
 at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:39)
 at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)
 at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
 at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:35)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
 at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
 at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
 at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
 at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:71)
 at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:69)
 at org.gradle.util.Swapper.swap(Swapper.java:38)
 at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:69)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
 at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
 at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
 at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:60)
 at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
 at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:45)
 at org.gradle.launcher.daemon.server.DaemonStateCoordinator.runCommand(DaemonStateCoordinator.java:184)
 at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49)
 at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
 at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:30)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
 at org.gradle.launcher.daemon.server.exec.DaemonHygieneAction.execute(DaemonHygieneAction.java:39)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
 at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
 at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:51)
 at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.handleCommand(DefaultIncomingConnectionHandler.java:155)
 at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.receiveAndHandleCommand(DefaultIncomingConnectionHandler.java:128)
 at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.run(DefaultIncomingConnectionHandler.java:116)
 at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:744)

(Radim Kubacki) #5

To Martin: does the hint in GRADLE-3101 fixes your problem or not? Can you show us the build script to check what causes this?


(m.ruegamer) #6

Thank you all,

adding [] around the configuration helped.

Is there a reason, why sourceSets.main.compileClasspath += configurations.provided works well without the [] ?

configurations {
 provided
}
  dependencies {
 provided group: 'javax.jnlp', name: 'jnlp', version: libraryVersions.jnlp
}
  sourceSets.main.compileClasspath += configurations.provided
eclipse.classpath.plusConfigurations += [configurations.provided]