向 POM.xml 添加依赖项时,是否可以排除主要工件本身。换句话说,我想向我的 pom 添加一个依赖项,并且我只想下载它的依赖项,而不是主 jar。
这就是我想要做的:
 <dependency>
    <groupId>net.sourceforge.htmlunit</groupId>
    <artifactId>htmlunit</artifactId>
    <version>2.12</version>
    <exclusions>
        <exclusion>
            <groupId>net.sourceforge.htmlunit</groupId>
            <artifactId>htmlunit</artifactId>
        </exclusion>
     </exclusions> 
</dependency>
我知道这可能看起来很奇怪,但实际上我的源文件夹中有 htmlunit 项目的修改版本,而我真正想要的只是它所依赖的库,而不必将它们全部添加到我的 pom.xml 中。
我尝试了上述方法,似乎 htmlunit-2.12.jar 已添加到我的项目中,这正是我想要避免的。
我能做些什么来解决这个问题?