ben-manes / gradle-versions-plugin

Gradle plugin to discover dependency updates
Apache License 2.0
3.88k stars 201 forks source link

Exception when changing version from 0.3 to 0.4 #10

Closed dodgex closed 10 years ago

dodgex commented 11 years ago

Today i did gradlew dependencyUpdates and got told that there is a 0.4 of this plugin.

after setting my 0.3 to 0.4 i get this message:

* Where: 
Build file 'E:\RadioApp\application\build.gradle' line: 13

A problem occurred evaluating project ':application'.
> Failed to notify action.
   > java.lang.NoSuchMethodError: com.google.common.base.Objects.toStringHelper(Ljava/lang/Object;)Lcom/google/common/base/Objects$ToStringHelper;

Line 13 is: apply plugin: 'android'

Here is the stacktrace.

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':application'.
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:131)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
        at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:469)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:77)
        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
        at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.Main.doAction(Main.java:48)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at org.gradle.launcher.Main.main(Main.java:39)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: org.gradle.listener.ListenerNotificationException: Failed to notify action.
        at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:90)
        at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
        at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
        at com.sun.proxy.$Proxy9.execute(Unknown Source)
        at org.gradle.listener.ActionBroadcast.execute(ActionBroadcast.java:30)
        at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:164)
        at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:159)
        at org.gradle.api.internal.DefaultNamedDomainObjectCollection.add(DefaultNamedDomainObjectCollection.java:71)
        at org.gradle.api.internal.AbstractNamedDomainObjectContainer.create(AbstractNamedDomainObjectContainer.java:57)
        at org.gradle.api.internal.AbstractNamedDomainObjectContainer.create(AbstractNamedDomainObjectContainer.java:39)
        at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:248)
        at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:136)
        at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
        at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
        at org.gradle.api.internal.FactoryNamedDomainObjectContainer_Decorated.invokeMethod(Unknown Source)
        at com.android.build.gradle.AppPlugin.apply(AppPlugin.groovy:115)
        at com.android.build.gradle.AppPlugin.apply(AppPlugin.groovy)
        at org.gradle.api.internal.plugins.DefaultPluginContainer.providePlugin(DefaultPluginContainer.java:107)
        at org.gradle.api.internal.plugins.DefaultPluginContainer.addPluginInternal(DefaultPluginContainer.java:71)
        at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:37)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)
        at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:39)
        at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:248)
        at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:136)
        at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
        at org.gradle.api.internal.project.DefaultProject_Decorated.invokeMethod(Unknown Source)
        at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)
        at org.gradle.api.Script$apply.callCurrent(Unknown Source)
        at build_1g57u27vcohlhd9dkd88uet837.run(E:\RadioApp\application\build.gradle:13)
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
        ... 33 more
Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoSuchMethodError: com.google.common.base.Objects.toStringHelper(Ljava/lang/Object;)Lcom/google/common/base/Objects$ToStringHelper;
        at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:58)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:81)
        ... 65 more
Caused by: java.lang.NoSuchMethodError: com.google.common.base.Objects.toStringHelper(Ljava/lang/Object;)Lcom/google/common/base/Objects$ToStringHelper;
        at com.android.build.gradle.internal.dsl.SigningConfigDsl.toString(SigningConfigDsl.java:133)
        at org.gradle.api.internal.BeanDynamicObject.getDisplayName(BeanDynamicObject.java:86)
        at org.gradle.api.internal.ExtensibleDynamicObject.getDisplayName(ExtensibleDynamicObject.java:101)
        at org.gradle.api.internal.AbstractDynamicObject.propertyMissingException(AbstractDynamicObject.java:43)
        at org.gradle.api.internal.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:35)
        at org.gradle.api.internal.CompositeDynamicObject.getProperty(CompositeDynamicObject.java:94)
        at com.android.build.gradle.internal.dsl.SigningConfigDsl_Decorated.getProperty(Unknown Source)
        at com.android.build.gradle.AppPlugin$_apply_closure1.doCall(AppPlugin.groovy:102)
        ... 69 more

maybe it is an incompability with the android plugin... no idea :(

I use gradle 1.7

ben-manes commented 11 years ago

This appears to be an unexpected side-effect of an early port of Maven's dependency analyze task. That task analyzes the class files to identify unused dependencies that can be removed. The analyzer has a transitive dependency to Google Collections 1.0, which is pre-Guava. Unfortunately, I guess Gradle doesn't isolate plugins into their own classloader to avoid these collisions.

It is currently disabled as it requires more work. Probably the best solution is to add an exclusion for com.google.collections:google-collections:1.0 in the next release and add a Guava one instead.

The only benefit of v0.4 is that it is (mostly) compatible with Gradle 1.8-rc-1.

runtime - Runtime classpath for source set 'main'.
+--- org.apache.maven.shared:maven-dependency-analyzer:1.4
|    +--- asm:asm:3.3.1
|    +--- org.codehaus.plexus:plexus-utils:1.5.1
|    +--- org.codehaus.plexus:plexus-component-annotations:1.5.5
|    +--- org.apache.maven:maven-project:2.0.5
|    |    +--- org.apache.maven:maven-settings:2.0.5
|    |    |    +--- org.apache.maven:maven-model:2.0.5
|    |    |    |    \--- org.codehaus.plexus:plexus-utils:1.1 -> 1.5.1
|    |    |    +--- org.codehaus.plexus:plexus-utils:1.1 -> 1.5.1
|    |    |    \--- org.codehaus.plexus:plexus-container-default:1.0-alpha-9 -> 1.5.5
|    |    |         +--- org.codehaus.plexus:plexus-utils:1.4.5 -> 1.5.1
|    |    |         +--- org.codehaus.plexus:plexus-classworlds:2.2.2
|    |    |         +--- org.apache.xbean:xbean-reflect:3.4
|    |    |         |    +--- log4j:log4j:1.2.12
|    |    |         |    \--- commons-logging:commons-logging-api:1.1
|    |    |         +--- com.google.collections:google-collections:1.0
|    |    |         \--- junit:junit:3.8.2
|    |    +--- org.apache.maven:maven-profile:2.0.5
|    |    |    +--- org.apache.maven:maven-model:2.0.5 (*)
|    |    |    +--- org.codehaus.plexus:plexus-utils:1.1 -> 1.5.1
|    |    |    \--- org.codehaus.plexus:plexus-container-default:1.0-alpha-9 -> 1.5.5 (*)
|    |    +--- org.apache.maven:maven-model:2.0.5 (*)
|    |    +--- org.apache.maven:maven-artifact-manager:2.0.5
|    |    |    +--- org.apache.maven:maven-repository-metadata:2.0.5
|    |    |    |    \--- org.codehaus.plexus:plexus-utils:1.1 -> 1.5.1
|    |    |    +--- org.codehaus.plexus:plexus-utils:1.1 -> 1.5.1
|    |    |    +--- org.apache.maven:maven-artifact:2.0.5
|    |    |    |    \--- org.codehaus.plexus:plexus-utils:1.1 -> 1.5.1
|    |    |    +--- org.codehaus.plexus:plexus-container-default:1.0-alpha-9 -> 1.5.5 (*)
|    |    |    \--- org.apache.maven.wagon:wagon-provider-api:1.0-beta-2
|    |    |         \--- org.codehaus.plexus:plexus-utils:1.0.4 -> 1.5.1
|    |    +--- org.codehaus.plexus:plexus-utils:1.1 -> 1.5.1
|    |    +--- org.apache.maven:maven-artifact:2.0.5 (*)
|    |    \--- org.codehaus.plexus:plexus-container-default:1.0-alpha-9 -> 1.5.5 (*)
|    +--- org.apache.maven:maven-model:2.0.5 (*)
|    \--- org.apache.maven:maven-artifact:2.0.5 (*)
\--- org.codehaus.plexus:plexus-container-default:1.5.5 (*)
jochenberger commented 11 years ago

google-collections is not the only one causing issues here. I also get issues because of the outdated asm dependency. I'll move the dependencyAnalyze-related code to a separate git branch.

dodgex commented 11 years ago

is the plugin with this changes again usable with the android plugin?

i would like to upgrade the android plugin but this requires Gradle 1.8.

jochenberger commented 11 years ago

I should think so, yes, but you're probably going to have to build it yourself as the 0.4 version in Maven central does not include the changes and I'm not able to create a release.

DHuckaby commented 10 years ago

Fyi, the android gradle plugin just upgraded to 0.7.0 and requires gradle 1.9 which causes this issue. Until this is fixed I can't use this plugin at all.

jochenberger commented 10 years ago

Could you please try to add

maven { url "https://github.com/ben-manes/gradle-versions-plugin/raw/mvnrepo" }

to your buildscript.repositories and update to 0.5-beta-1?

jochenberger commented 10 years ago

Please reopen if you still have issues with the newest version.