Scala Spark with Pureconfig-正确的maven shade插件配置

Scala Spark with Pureconfig-正确的maven shade插件配置,scala,maven,apache-spark,sbt,maven-shade-plugin,Scala,Maven,Apache Spark,Sbt,Maven Shade Plugin,我的问题与这里描述的完全相同: . 上述问题的唯一答案似乎是合理的,但我正在使用Maven而不是sbt,并且我无法将发布的解决方案从sbt转换为Maven 我尝试过以下方法: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.0.0</version>

我的问题与这里描述的完全相同: . 上述问题的唯一答案似乎是合理的,但我正在使用Maven而不是sbt,并且我无法将发布的解决方案从sbt转换为Maven

我尝试过以下方法:

<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>com.chuusai:shapeless_2.11:2.3.2</pattern>
            <shadedPattern>com.matek.shaded.com.chuusai:shapeless_2.11:2.3.2</shadedPattern>
        </relocation>
        <relocation>
            <pattern>com.chuusai:shapeless_2.11:2.0.0</pattern>
            <shadedPattern>com.matek.shaded.com.chuusai:shapeless_2.11:2.0.0</shadedPattern>
        </relocation>
        <relocation>
            <pattern>com.github.pureconfig</pattern>
            <shadedPattern>com.matek.shaded.com.github.pureconfig</shadedPattern>
            <excludes>
                <exclude>com.chuusai:shapeless_2.11:2.3.2</exclude>
            </excludes>
            <includes>
                <include>com.matek.shaded.com.chuusai:shapeless_2.11:2.3.2</include>
            </includes>
        </relocation>
    </relocations>
</configuration>

org.apache.maven.plugins
maven阴影插件
3.0.0
包裹
阴凉处
假的
com.chuusai:shapeless_2.11:2.3.2
com.matek.shaded.com.chuusai:shapeless_2.11:2.3.2
com.chuusai:shapeless_2.11:2.0.0
com.matek.shaded.com.chuusai:shapeless_2.11:2.0.0
com.github.pureconfig
com.matek.shade.com.github.pureconfig
com.chuusai:shapeless_2.11:2.3.2
com.matek.shaded.com.chuusai:shapeless_2.11:2.3.2

但毫不奇怪,这是行不通的(我甚至不确定它是否正确)。
如何指定maven shade插件配置,使其与spark submit一起工作?

我设法解决了这个问题。这实际上是我的错误,模式只是
不成形
,而不是像
com.chuusai.shapess
。这起到了作用:

            <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.matek.shaded.shapeless</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
            </plugin>

org.apache.maven.plugins
maven阴影插件
3.0.0
包裹
阴凉处
假的
不成形
com.matek.shaded.shapeless

我设法解决了这个问题。这实际上是我的错误,模式只是
不成形
,而不是像
com.chuusai.shapess
。这起到了作用:

            <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.matek.shaded.shapeless</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
            </plugin>

org.apache.maven.plugins
maven阴影插件
3.0.0
包裹
阴凉处
假的
不成形
com.matek.shaded.shapeless

不幸的是,我没有工作:这里也一样。没有找到maven和使用spark 2.1的工作示例。仅提及GeorgHeiler的评论,似乎他成功地使其工作,因此@horatio1701d请查看github链接。实际上,我是用spark 2.1来实现的,而且它是有效的,所以另外要确保所有的包名都是正确的(这是我一直在努力解决的问题)。@Matek,你有可以共享的maven配置吗?这个链接似乎只针对sbt,除非我遗漏了什么。我尝试了你提出的maven配置,但这给了我同样的问题。您能更具体地说明我在maven配置中应该注意哪些包名吗。尝试使用您在添加无形状maven包2.3.2之后添加的内容。不知道我错过了什么。不幸的是,我没有工作:这里也一样。没有找到maven和使用spark 2.1的工作示例。仅提及GeorgHeiler的评论,似乎他成功地使其工作,因此@horatio1701d请查看github链接。实际上,我是用spark 2.1来实现的,而且它是有效的,所以另外要确保所有的包名都是正确的(这是我一直在努力解决的问题)。@Matek,你有可以共享的maven配置吗?这个链接似乎只针对sbt,除非我遗漏了什么。我尝试了你提出的maven配置,但这给了我同样的问题。您能更具体地说明我在maven配置中应该注意哪些包名吗。尝试使用您在添加无形状maven包2.3.2之后添加的内容。不知道我错过了什么。