以下の解決策はSpark not working with pureconfigから取られていますが、これを行うためにはmavenのバージョンが分かりません。 pureconfig 0.8をspark-submitを使ってspark 2.1で動作させようとしましたが、IntelliJ以外でも厄介なException in thread "main" java.lang.NoSuchMethodError: shapeless.Witness$.mkWitness(Ljava/lang/Object;)Lshapeless/Witness;
エラーが発生しました。Pureconfigを使ったSpark 2.1 Mavenの回避策
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("shapeless.**" -> "[email protected]")
.inLibrary("com.chuusai" % "shapeless_2.11" % "2.3.2")
.inLibrary("com.github.pureconfig" %% "pureconfig" % "0.7.0")
.inProject
)
Spark with Pureconfig - proper maven shade plugin configurationでも解決策を試したことがありますが、運がまだありません。
uber
jarファイルを作成して使用した場合の最終的な設定ですが、Mavenシェーディングの仕組みを完全に理解していないと、名前を変更したjarファイルを別に作成する必要がありません。理想的には私はちょうど作成された依存関係を持つjarファイルを使用して、以下を追加第三のjarを作成しないようにしたい:こんなに遅く答えるため
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<relocations>
<relocation>
<pattern>shapeless</pattern>
<shadedPattern>com.shaded.shapeless</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<finalName>uber-${project.artifactId}-${project.version}</finalName>
</configuration>
</plugin>
シェイプレスなパッケージ名で例外が発生した場合は、ソースコードの陰影や内部の依存関係が正しく機能していないことを意味します。 Mavenにシェーディング設定を追加できますか? –
ありがとうございます。私が試した構成を追加するための質問を更新しました。 – horatio1701d