aantono / gradle-plugin-protobuf

Protobuf Plugin for Gradle has moved to
https://github.com/google/protobuf-gradle-plugin
BSD 3-Clause "New" or "Revised" License
40 stars 24 forks source link

Unable to build proto in generateProto task #8

Closed felixgao closed 11 years ago

felixgao commented 11 years ago

plugin used is 'ws.antonov.gradle.plugins:gradle-plugin-protobuf:0.7'

The proto file looks like the following

message SegmentStatProtoResult { required int64 aCount = 1; required int64 tCount = 2; required int64 cCount = 3; required int64 iCount = 4; optional string name = 5; optional int32 status = 6;

message Stats { required int32 nid = 1; required int32 cid = 2; required int64 cSize = 3; }

repeated Stats stats = 7; required int32 sNum = 8; required int32 sDenom = 9; required string dataset = 10; }

See stack trace below.

11:59:13.388 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':generateProto' 11:59:13.390 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :generateProto FAILED 11:59:13.462 [ERROR] [org.gradle.BuildExceptionReporter] 11:59:13.469 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception. 11:59:13.471 [ERROR] [org.gradle.BuildExceptionReporter] 11:59:13.472 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: 11:59:13.481 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':generateProto'. 11:59:13.495 [ERROR] [org.gradle.BuildExceptionReporter] > No signature of method: static org.gradle.util.CollectionUtils.join() is applicable for argument types: (java.lang.String, java.util.LinkedHashSet) values: [ -I, [/Users/felixgao/projects/git_bk_proto/src/main/proto, ...]] 11:59:13.496 [ERROR] [org.gradle.BuildExceptionReporter] Possible solutions: wait(), find(), notify(), any(), dump(), grep() 11:59:13.499 [ERROR] [org.gradle.BuildExceptionReporter] 11:59:13.548 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is: 11:59:13.566 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':generateProto'. 11:59:13.567 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:68) 11:59:13.567 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) 11:59:13.573 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34) 11:59:13.574 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter$1.run(CacheLockHandlingTaskExecuter.java:34) 11:59:13.576 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess$3.create(DefaultCacheAccess.java:243) 11:59:13.577 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:188) 11:59:13.578 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:241) 11:59:13.579 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:137) 11:59:13.580 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83) 11:59:13.581 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter.execute(CacheLockHandlingTaskExecuter.java:32) 11:59:13.582 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55) 11:59:13.583 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57) 11:59:13.596 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41) 11:59:13.597 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51) 11:59:13.597 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52) 11:59:13.598 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42) 11:59:13.609 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247) 11:59:13.610 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.executeTask(DefaultTaskPlanExecutor.java:52) 11:59:13.611 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.processTask(DefaultTaskPlanExecutor.java:38) 11:59:13.611 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:30) 11:59:13.612 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83) 11:59:13.613 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29) 11:59:13.614 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61) 11:59:13.614 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23) 11:59:13.615 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67) 11:59:13.616 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31) 11:59:13.617 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess$2.create(DefaultCacheAccess.java:118) 11:59:13.617 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:133) 11:59:13.618 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:116) 11:59:13.633 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:129) 11:59:13.633 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79) 11:59:13.635 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29) 11:59:13.636 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61) 11:59:13.637 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23) 11:59:13.638 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67) 11:59:13.640 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) 11:59:13.641 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61) 11:59:13.642 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54) 11:59:13.760 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:158) 11:59:13.760 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113) 11:59:13.772 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81) 11:59:13.773 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38) 11:59:13.825 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39) 11:59:13.826 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25) 11:59:13.827 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50) 11:59:13.837 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ActionAdapter.execute(ActionAdapter.java:30) 11:59:13.837 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ActionAdapter.execute(ActionAdapter.java:22) 11:59:13.838 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:200) 11:59:13.962 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:173) 11:59:13.963 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169) 11:59:13.968 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:138) 11:59:13.969 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) 11:59:13.969 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) 11:59:13.971 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.doAction(Main.java:48) 11:59:13.972 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) 11:59:13.973 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.main(Main.java:39) 11:59:13.974 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50) 11:59:13.974 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32) 11:59:13.975 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.GradleMain.main(GradleMain.java:26) 11:59:13.976 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: groovy.lang.MissingMethodException: No signature of method: static org.gradle.util.CollectionUtils.join() is applicable for argument types: (java.lang.String, java.util.LinkedHashSet) values: [ -I, [/Users/felixgao/projects/git_bk_proto/src/main/proto, ...]] 11:59:13.976 [ERROR] [org.gradle.BuildExceptionReporter] Possible solutions: wait(), find(), notify(), any(), dump(), grep() 11:59:13.977 [ERROR] [org.gradle.BuildExceptionReporter] at ws.antonov.gradle.plugins.protobuf.ProtobufCompile.compile(ProtobufCompile.groovy:33) 11:59:13.978 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:216) 11:59:13.978 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:122) 11:59:13.980 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147) 11:59:13.981 [ERROR] [org.gradle.BuildExceptionReporter] at ws.antonov.gradle.plugins.protobuf.ProtobufCompile_Decorated.invokeMethod(Unknown Source) 11:59:13.982 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23) 11:59:13.991 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:161) 11:59:13.992 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:156) 11:59:13.993 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:472) 11:59:13.994 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:461) 11:59:14.035 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:60) 11:59:14.038 [ERROR] [org.gradle.BuildExceptionReporter] ... 58 more 11:59:14.039 [ERROR] [org.gradle.BuildExceptionReporter] 11:59:14.040 [LIFECYCLE] [org.gradle.BuildResultLogger] 11:59:14.041 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED

aantono commented 11 years ago

What version of Gradle are you using?

felixgao commented 11 years ago

radle -version


Gradle 1.2

Gradle build time: Wednesday, September 12, 2012 10:46:02 AM UTC Groovy: 1.8.6 Ant: Apache Ant(TM) version 1.8.4 compiled on May 22 2012 Ivy: 2.2.0 JVM: 1.6.0_37 (Apple Inc. 20.12-b01-434) OS: Mac OS X 10.6.8 x86_64

aantono commented 11 years ago

Can you give it a try using 1.3? It might be that the org.gradle.util.CollectionUtils.join() method was introduced in Gradle 1.3 (since this is the version used to build the plugin)

felixgao commented 11 years ago

You are right upgrading to 1.4 solves the above problem but I have a new problem now.

[17:24:32][~/projects/git_proto] $> find . -name *.java ./build/generated-sources/main/com/ds/adr.java

[17:25:50][~/projects/git_proto] $> jar -tf ./build/libs/git_proto.jar META-INF/ META-INF/MANIFEST.MF

how come the generated source is not compiled and packaged into the jar?

aantono commented 11 years ago

The protobuf plugin by itself does not compile code, it only executes protoc which generates *.java stubs which would later be compiled by the compileJava task from within the java plugin.

felixgao commented 11 years ago

I am still confused. [10:38:30][~/projects/git_proto] $> gradle jar :extractProto :generateProto UP-TO-DATE :compileJava :processResources UP-TO-DATE :classes :jar

BUILD SUCCESSFUL

Total time: 8.248 secs [10:38:56][~/projects/git_proto] $> jar -tf ./build/libs/git_proto.jar META-INF/ META-INF/MANIFEST.MF

Seems it did execute the compileJava task but the generated source is not compiled or packaged.

aantono commented 11 years ago

That does seem a bit weird indeed. Do you have a zip archive of your project that you can share, so that I can reproduce the problem on my end to see what could be going wrong? The java plugin's jar task should just jar up everything inside the build/classes/main directory, and the compileJava task should take the generated java protobuf files and compile them into the build/classes/main directory. Can you verify that the classes do indeed get compiled?

aantono commented 11 years ago

I am going to close this issue as I am unable to reproduce this problem on my own and the issuer did not provide any steps/archived project to help reproduce this issue. If someone encounters this issue though, please reopen this ticket and provide steps to reproduce the problem.

Thanks!