如何将特定版本的jar包含到Uber jar中?

问题描述 投票:0回答:1

[构建项目时,maven下载了依赖关系spark-avro,版本1.8.2和2.4.3,并且打包了错误的依赖项。

在我的pom.xml文件中,我只有spark-avro版本2.4.3,1.8.2是其他地方的可传递依赖。

我如何指定要放入uber jar的具体版本?我试着做:

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <finalName>${project.artifactId}-assembly</finalName>
                        <relocations>
                            <relocation>
                                <pattern>org.apache.http</pattern>
                                <shadedPattern>org.shaded.apache.http</shadedPattern>
                            </relocation>
                        </relocations>
                        <filters>
                            <filter>
                                <artifact>com.alcon.salesforce.etl:alcon-salesforce-etl</artifact>
                                <excludes>
                                    <exclude>com/alcon/etl/glue/common/**</exclude>
                                </excludes>
                            </filter>
                        </filters>
                        <artifactSet>
                            <includes>
this --------------------->   <include>org.apache.avro:spark-avro_2.11:2.4.3</include>
                                <include>com.alcon.etl.common:*</include>
                            </includes>
                        </artifactSet>
                        <shadedArtifactAttached>true</shadedArtifactAttached>
                        <shadedClassifierName>assembly</shadedClassifierName>
                    </configuration>
                </execution>
            </executions>
        </plugin>

[如您在顶部看到的,我在那里写了特定版本的spark-avro,它是org.apache.avro:spark-avro_2.11:2.4.3,但我搞砸了,因为当我提取生成的jar的内容时,那里没有火花。] >

正确的语法是什么?

[构建项目时,maven下载了1.8.2和2.4.3版本的spark-avro依赖项,并且打包了错误的依赖项。在我的pom.xml文件中,我仅具有spark-avro版本2.4.3,1.8.2是...

maven maven-assembly-plugin
1个回答
0
投票

您在看错地方。 Maven首先将依赖关系合并到一个列表中(每个工件仅在一个版本中出现)。您的<include>只是此列表上的过滤器。

© www.soinside.com 2019 - 2024. All rights reserved.