Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 用SBT缩放和着色是';行不通_Scala_Apache Spark_Sbt Assembly_Maven Shade Plugin_Scalapb - Fatal编程技术网

Scala 用SBT缩放和着色是';行不通

Scala 用SBT缩放和着色是';行不通,scala,apache-spark,sbt-assembly,maven-shade-plugin,scalapb,Scala,Apache Spark,Sbt Assembly,Maven Shade Plugin,Scalapb,我正试着去https://scalapb.github.io/“>ScalaPB与Spark一起工作。为了做到这一点,我需要使用下面的代码对SBT中的协议缓冲区进行着色 assemblyShadeRules in assembly := Seq( ShadeRule.rename("com.google.protobuf.**" -> "shadeproto.@1").inAll ) 这在spark shell中不起作用。事实上,它甚至在Scala REPL中也不起作用。下面是我在R

我正试着去https://scalapb.github.io/“>ScalaPB与Spark一起工作。为了做到这一点,我需要使用下面的代码对SBT中的协议缓冲区进行着色

assemblyShadeRules in assembly := Seq(
  ShadeRule.rename("com.google.protobuf.**" -> "shadeproto.@1").inAll
)
这在spark shell中不起作用。事实上,它甚至在Scala REPL中也不起作用。下面是我在REPL中的错误

Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_102).
Type in expressions for evaluation. Or try :help.

  scala> val x = zefr.commons.proto.Video.VideoProto.descriptor
error: missing or invalid dependency detected while loading class file 'VideoProto.class'.
Could not access term google in package com,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'VideoProto.class' was compiled against an incompatible version of com.
error: missing or invalid dependency detected while loading class file 'VideoProto.class'.
Could not access term protobuf in value com.google,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'VideoProto.class' was compiled against an incompatible version of com.google.
  error: missing or invalid dependency detected while loading class file 'GeneratedMessageCompanion.class'.
Could not access term google in package com,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'GeneratedMessageCompanion.class' was compiled against an incompatible version of com.
error: missing or invalid dependency detected while loading class file 'GeneratedMessageCompanion.class'.
Could not access term protobuf in value com.google,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'GeneratedMessageCompanion.class' was compiled against an incompatible version of com.google.
  error: missing or invalid dependency detected while loading class file 'VideoProto.class'.
Could not access term Descriptors in value com.protobuf,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'VideoProto.class' was compiled against an incompatible version of com.protobuf.
  error: missing or invalid dependency detected while loading class file 'VideoProto.class'.
Could not access term protobuf in value com.google,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'VideoProto.class' was compiled against an incompatible version of com.google.
  error: missing or invalid dependency detected while loading class file 'VideoProto.class'.
Could not access term google in package com,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'VideoProto.class' was compiled against an incompatible version of com.
error: missing or invalid dependency detected while loading class file 'VideoProto.class'.
Could not access type Descriptor in value com.Descriptors,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'VideoProto.class' was compiled against an incompatible version of com.Descriptors.
这是我的build.sbt文件的完整副本

scalaVersion := "2.11.8"
organization := "zefr.commons"
name := "commons-proto"


val nexus = "http://nexus.zefr.com/repository/maven"
resolvers ++= Seq(
  Resolver.sonatypeRepo("releases"),
  Resolver.sonatypeRepo("snapshots"),
  "Neuxs Snapshots" at s"$nexus-snapshots",
  "Neuxs Releases" at s"$nexus-releases"
)
conflictManager := ConflictManager.strict

PB.targets in Compile := Seq(
  scalapb.gen() -> (sourceManaged in Compile).value
)

assemblyShadeRules in assembly := Seq(
  ShadeRule.rename("com.google.protobuf.**" -> "shadeproto.@1").inAll
)
和项目/protos.sbt

addSbtPlugin("com.thesamet" % "sbt-protoc" % "0.99.3")

libraryDependencies += "com.trueaccord.scalapb" %% "compilerplugin" % "0.5.45-p3"

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3")
有人能帮我理解我在这里遗漏了什么吗

谢谢

编辑

为了查看这是否是我介绍的问题,我下载了项目并按原样构建了它,只将Scala版本更改为2.11.8,我得到了相同的错误

scala> val x = com.example.protos.demo.Person.descriptor
error: missing or invalid dependency detected while loading class file 'Person.class'.
Could not access term google in package com,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'Person.class' was compiled against an incompatible version of com.
error: missing or invalid dependency detected while loading class file 'Person.class'.
Could not access term protobuf in value com.google,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'Person.class' was compiled against an incompatible version of com.google.
  error: missing or invalid dependency detected while loading class file 'GeneratedMessageCompanion.class'.
Could not access term google in package com,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'GeneratedMessageCompanion.class' was compiled against an incompatible version of com.
error: missing or invalid dependency detected while loading class file 'GeneratedMessageCompanion.class'.
Could not access term protobuf in value com.google,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'GeneratedMessageCompanion.class' was compiled against an incompatible version of com.google.
  error: missing or invalid dependency detected while loading class file 'Person.class'.
Could not access term Descriptors in value com.protobuf,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'Person.class' was compiled against an incompatible version of com.protobuf.
  error: missing or invalid dependency detected while loading class file 'Person.class'.
Could not access term protobuf in value com.google,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'Person.class' was compiled against an incompatible version of com.google.
  error: missing or invalid dependency detected while loading class file 'Person.class'.
Could not access term google in package com,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'Person.class' was compiled against an incompatible version of com.
error: missing or invalid dependency detected while loading class file 'Person.class'.
Could not access type Descriptor in value com.Descriptors,
because it (or its dependencies) are missing. Check your build definition for
  missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'Person.class' was compiled against an incompatible version of com.Descriptors.

我在某种程度上解决了这个问题。事实证明,我可以通过使用基于Java的getDescriptor方法而不是Scala描述符来绕过上面提到的非常具体的问题。然后一切都很好。我不会给出这个答案,因为它并不能解决我上面概述的整个问题,但对于那些通过在未来的日子里,这一点是不可能的。