在使用Maven Shade插件构建超级jar时,我试图排除一系列工件。以下是我正在使用的配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<artifactSet>
<excludes>
<exclude>com.fasterxml.jackson.core:jackson-core:jar:2.4.5</exclude>
</excludes>
</artifactSet>
...
在没有版本信息的情况下排除软件包:
<exclude>com.fasterxml.jackson.core:jackson-core</exclude>
但不幸的是,这不是一个选项,因为需要包含不同版本的工件。
答案 0 :(得分:0)
我认为你只需要定义你正在使用哪个版本的jackson。
显然,如果您对不同版本具有相同的依赖关系(可能是传递性的),这是不好的做法。在这种情况下,您无法知道该库的哪个版本将最终出现在您的项目中。您可以在xml中替换依赖项顺序,然后最终结果将不同。听起来不错,是吗?
所以你需要指定 - 你的dependencyManagement部分中的jackson的确切版本:
<textarea id="in" rows="40" cols="80">{NAME}
THANKS ____ AND ____. AS WE REPORTED LAST MONDAY, BATMAN VS SUPERMAN: DAWN OF JUSTICE CAME OUT THIS PAST WEEKEND AND IT SET SOME BOX OFFICE RECORDS.
{NAME}
(DDR) That's right ____. 'Batman v Superman' took huge $170 million at the box office. Audiences flocked to see the pairing of Batman (Ben Affleck) versus Superman (Henry Cavill) in the DC Comics film, which also introduced Wonder Woman (Gal Gadot).
{NAME}
IT'S THE BIGGEST MARCH OPENING WEEKEND EVER, EVEN BEATING 2012'S THE HUNGER GAMES' WHO BROUGHT IN $152.5 MILLION.
{NAME}
IN OTHER NEWS - SYRACUSE IS THE FIRST 10 SEED TO MAKE IT TO THE FINAL FOUR.
(ad lib)
</textarea>
<br/>
<input type="button" onclick="f()" value="Format"/>
这将确保您的工件中只有特定版本,并且您不需要排除特定版本。
希望这有帮助