sbt-assembly
如果有人可以提供帮助,我有一个奇怪的问题
当试图创建胖 jar 以部署到 Spark 并应用到shapeless
库的阴影时,我看到一些类在 Ubuntu 机器上运行时没有被重命名,而sbt assembly
在 Mac 中运行时一切都被重命名。
这是阴影配置
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("shapeless.**" -> "shadedshapeless.@1")
.inLibrary("com.chuusai" % "shapeless_2.11" % "2.3.2")
.inLibrary("com.github.pureconfig" % "pureconfig_2.11" % "0.7.0")
.inProject)
在 Mac 中运行时,这些类被重命名为模式shapeless/Generic*
Renamed shapeless/Generic$.class -> shadedshapeless/Generic$.class
Renamed shapeless/Generic.class -> shadedshapeless/Generic.class
Renamed shapeless/Generic1$.class -> shadedshapeless/Generic1$.class
Renamed shapeless/Generic1$class.class -> shadedshapeless/Generic1$class.class
Renamed shapeless/Generic1.class -> shadedshapeless/Generic1.class
Renamed shapeless/Generic10$class.class -> shadedshapeless/Generic10$class.class
Renamed shapeless/Generic10.class -> shadedshapeless/Generic10.class
Renamed shapeless/Generic1Macros$$anonfun$1.class -> shadedshapeless/Generic1Macros$$anonfun$1.class
Renamed shapeless/Generic1Macros$$anonfun$2.class -> shadedshapeless/Generic1Macros$$anonfun$2.class
Renamed shapeless/Generic1Macros.class -> shadedshapeless/Generic1Macros.class
Renamed shapeless/GenericMacros$$anonfun$23.class -> shadedshapeless/GenericMacros$$anonfun$23.class
Renamed shapeless/GenericMacros.class -> shadedshapeless/GenericMacros.class
但是当在 Ubuntu 中运行时,对于模式shapless/Generic*
只有这些东西被重命名
Renamed shapeless/GenericMacros$$anonfun$23.class -> shadedshapeless/GenericMacros$$anonfun$23.class
Renamed shapeless/Generic1Macros$$anonfun$1.class -> shadedshapeless/Generic1Macros$$anonfun$1.class
Renamed shapeless/Generic1$.class -> shadedshapeless/Generic1$.class
Renamed shapeless/Generic1.class -> shadedshapeless/Generic1.class
shapeless/Generic*
我在提供 fat jar(在 Ubuntu 中生成)时选择了模式,spark-submit
然后立即收到错误(可能来自pureconfig
)
Exception in thread "main" java.lang.NoClassDefFoundError: shadedshapeless/Generic
将Mac生产的脂肪罐送入时不会发生错误spark-submit