如何在运行时从Maven依赖项(Jar依赖项)中排除特定类

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

如何从Maven依赖项(Jar依赖项)中排除特定类。

我在avro-tools.jar中遇到了ObjectUtils.class的问题,该问题是在运行时选择的,没有使用commons-lang3 jar中使用的方法。导致运行时出现NoSuchMethod错误。

我想知道有什么方法可以在pom.xml中指定以从avro-tools.jar(1.9.1)版本中排除此类org.apache.commons.lang3.ObjectUtils并从commons-lang3中选择它.jar(3.9版本)

java maven maven-plugin
1个回答
-2
投票

尝试使用maven-shade-plugin,它将从pom.xml生成的最终jar中删除类

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