gogradle
gogradle copied to clipboard
NPE Happens When Adding GRPC As Dependency
gogradle seems to be throwing an npe when trying to include GRPC as a dependency. I have created a simple sample project which exhibits this behavior:
https://github.com/devnulled/gogradle-grpc-npe
➜ gogradle-grpc-npe git:(master) ✗ ./gradlew build --stacktrace
Configuration on demand is an incubating feature.
> Configure project :
Found go 1.10 in /usr/local/bin/go, use it.
> Task :prepare
Use project GOPATH: /Users/brandon/dev/devnulled/gogradle-grpc-npe/.gogradle/project_gopath
> Task :resolveBuildDependencies
Resolving google.golang.org/grpc: commit='LATEST_COMMIT', urls=[https://github.com/grpc/grpc-go]
Resolving github.com/golang/glog: commit='LATEST_COMMIT', urls=[https://github.com/golang/glog.git, [email protected]:golang/glog.git]
Resolving github.com/golang/mock: commit='LATEST_COMMIT', urls=[https://github.com/golang/mock.git, [email protected]:golang/mock.git]
Resolving github.com/golang/protobuf: commit='LATEST_COMMIT', urls=[https://github.com/golang/protobuf.git, [email protected]:golang/protobuf.git]
Resolving golang.org/x/net: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/net]
Resolving golang.org/x/oauth2: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/oauth2]
Resolving google.golang.org/genproto: commit='LATEST_COMMIT', urls=[https://github.com/google/go-genproto]
Resolving cached golang.org/x/net: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/net]
Resolving golang.org/x/crypto: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/crypto]
Resolving golang.org/x/text: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/text]
Resolving cloud.google.com/go: commit='LATEST_COMMIT', urls=[https://code.googlesource.com/gocloud]
Resolving cached golang.org/x/net: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/net]
Resolving cached github.com/golang/protobuf: commit='LATEST_COMMIT', urls=[https://github.com/golang/protobuf.git, [email protected]:golang/protobuf.git]
Resolving cached golang.org/x/net: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/net]
Resolving google.golang.org/grpc: commit='LATEST_COMMIT', urls=[https://github.com/grpc/grpc-go]
Resolving golang.org/x/sys: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/sys]
Resolving golang.org/x/tools: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/tools]
Resolving cached github.com/golang/mock: commit='LATEST_COMMIT', urls=[https://github.com/golang/mock.git, [email protected]:golang/mock.git]
Resolving cached github.com/golang/protobuf: commit='LATEST_COMMIT', urls=[https://github.com/golang/protobuf.git, [email protected]:golang/protobuf.git]
Resolving github.com/google/btree: commit='LATEST_COMMIT', urls=[https://github.com/google/btree.git, [email protected]:google/btree.git]
Resolving github.com/google/go-cmp: commit='LATEST_COMMIT', urls=[https://github.com/google/go-cmp.git, [email protected]:google/go-cmp.git]
Resolving github.com/google/pprof: commit='LATEST_COMMIT', urls=[https://github.com/google/pprof.git, [email protected]:google/pprof.git]
Resolving github.com/googleapis/gax-go: commit='LATEST_COMMIT', urls=[https://github.com/googleapis/gax-go.git, [email protected]:googleapis/gax-go.git]
Resolving go.opencensus.io: commit='LATEST_COMMIT', urls=[https://github.com/census-instrumentation/opencensus-go]
Resolving golang.org/x/build: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/build]
Resolving golang.org/x/debug: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/debug]
Resolving cached golang.org/x/net: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/net]
Resolving cached golang.org/x/oauth2: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/oauth2]
Resolving golang.org/x/sync: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/sync]
Resolving cached golang.org/x/text: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/text]
Resolving golang.org/x/time: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/time]
Resolving google.golang.org/api: commit='LATEST_COMMIT', urls=[https://code.googlesource.com/google-api-go-client]
Resolving cached google.golang.org/genproto: commit='LATEST_COMMIT', urls=[https://github.com/google/go-genproto]
Resolving cached google.golang.org/grpc: commit='LATEST_COMMIT', urls=[https://github.com/grpc/grpc-go]
Resolving cached golang.org/x/net: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/net]
Resolving github.com/ianlancetaylor/demangle: commit='LATEST_COMMIT', urls=[https://github.com/ianlancetaylor/demangle.git, [email protected]:ianlancetaylor/demangle.git]
Resolving cached golang.org/x/net: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/net]
Resolving cached google.golang.org/grpc: commit='LATEST_COMMIT', urls=[https://github.com/grpc/grpc-go]
Resolving cached golang.org/x/net: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/net]
Resolving cached golang.org/x/net: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/net]
Resolving cached go.opencensus.io: commit='LATEST_COMMIT', urls=[https://github.com/census-instrumentation/opencensus-go]
Resolving cached golang.org/x/net: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/net]
Resolving cached golang.org/x/oauth2: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/oauth2]
Resolving cached golang.org/x/sync: commit='LATEST_COMMIT', urls=[https://go.googlesource.com/sync]
Resolving cached google.golang.org/genproto: commit='LATEST_COMMIT', urls=[https://github.com/google/go-genproto]
Resolving cached google.golang.org/grpc: commit='LATEST_COMMIT', urls=[https://github.com/grpc/grpc-go]
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':resolveBuildDependencies'.
> java.lang.NullPointerException (no error message)
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':resolveBuildDependencies'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.NullPointerException
at com.github.blindpirate.gogradle.core.dependency.tree.DependencyTreeFactory.getSubTree(DependencyTreeFactory.java:57)
at com.github.blindpirate.gogradle.core.dependency.tree.DependencyTreeFactory.getTree(DependencyTreeFactory.java:40)
at com.github.blindpirate.gogradle.task.ResolveDependencies.resolveDependencies(ResolveDependencies.java:172)
at com.github.blindpirate.gogradle.task.ResolveDependencies.resolve(ResolveDependencies.java:153)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:788)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:755)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
... 30 more
* Get more help at https://help.gradle.org
BUILD FAILED in 17s
2 actionable tasks: 2 executed
The cause is unbelievable... you should use
mycode.devnulled.com
instead of
mycode.devnulled.com/
But this should be improved, for sure. :-)
Thanks @blindpirate, that seemed to have done the trick.
I wouldn't mind trying to submit a patch for this? I would assume the behavior should be that it ignores/strips trailing slashes, or that it gives you an error with the build and tells you how to fix it?
I think a path with or without trailing slashes should be treated equally. Anyway current error is totally uninformative.
I wouldn't mind trying to submit a patch for this?
If you want to express you'd like to submit a PR, you're always welcomed.