当我从selenium下载依赖项时,我想排除Apache Ivy解决方案中的一些jar,例如selenium-safari-driver-2.53.1.jar,selenium-edge-driver.2.53.1.jar,selenium-support。罐子等等。然而,经过反复尝试并尝试不同的匹配器和类型的组合,它似乎没有工作.Below是我的Ivy.xml
<configurations>
<conf name="core" description="only ivy jar, without any dependencies"/>
<conf name="standalone" extends="core" description="to launch in standalone mode (from command line)"/>
<conf name="default" extends="core" description="full ivy with all dependencies"/>
<conf name="test" description="dependencies used for junit testing ivy" visibility="private"/>
<conf name="source" description="ivy sources"/>
</configurations>
<publications>
<artifact name="ivy" type="jar" conf="core"/>
<artifact name="ivy" type="source" ext="jar" conf="source"/>
</publications>
<dependencies>
<dependency org="org.seleniumhq.selenium" name="selenium-java" rev="2.53.1"/>
<dependency org="org.testng" name="testng" rev="6.8"/>
<exclude type="javadoc" ext="*" conf="*"/>
<exclude type="source" ext="*" conf="*"/>
<exclude type="license" ext="*" conf="*"/>
<exclude org="seleniumhq.selenium" module="safari-driver" matcher="regexp" />
</dependencies>
请让我知道如何有效地包含这些排除。
答案 0 :(得分:0)
Ivy将解决所有依赖项。排除项可用于确定特定常春藤配置的内容。
您需要包含配置映射,通常只需使用&#34;默认&#34;远程模块的配置,它将排除source和javadocs:
<dependency org="??" name="??" rev="???" conf="mylocalconf->default">
├── build.xml
├── ivy.xml
└── target
└── lib
├── cglib-nodep-2.1_3.jar
├── commons-codec-1.10.jar
├── commons-exec-1.3.jar
├── commons-io-2.4.jar
├── commons-logging-1.2.jar
├── gson-2.3.1.jar
├── guava-19.0.jar
├── htmlunit-driver-2.21.jar
├── httpclient-4.5.1.jar
├── httpcore-4.4.3.jar
├── jna-4.1.0.jar
├── jna-platform-4.1.0.jar
├── netty-3.5.7.Final.jar
├── selenium-api-2.53.1.jar
├── selenium-java-2.53.1.jar
├── selenium-leg-rc-2.53.1.jar
└── selenium-support-2.53.1.jar
<ivy-module version="2.0">
<info organisation="com.myspotontheweb" module="demo"/>
<configurations>
<conf name="compile" description="Required to compile application"/>
<conf name="runtime" description="Additional run-time dependencies" extends="compile"/>
<conf name="test" description="Required for test only" extends="runtime"/>
</configurations>
<dependencies>
<!-- compile dependencies -->
<dependency org="org.seleniumhq.selenium" name="selenium-java" rev="2.53.1" conf="compile->default">
<exclude org="org.seleniumhq.selenium" name="selenium-chrome-driver"/>
<exclude org="org.seleniumhq.selenium" name="selenium-edge-driver"/>
<exclude org="org.seleniumhq.selenium" name="selenium-firefox-driver"/>
<exclude org="org.seleniumhq.selenium" name="selenium-ie-driver"/>
<exclude org="org.seleniumhq.selenium" name="selenium-remote-driver"/>
<exclude org="org.seleniumhq.selenium" name="selenium-safari-driver"/>
</dependency>
<!-- test dependencies -->
<dependency org="org.testng" name="testng" rev="6.8" conf="test->default"/>
</dependencies>
</ivy-module>
注意:
<project name="demo" default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="resolve">
<ivy:resolve/>
<ivy:retrieve pattern="target/lib/[artifact]-[revision](-[classifier]).[ext]" conf="compile"/>
</target>
</project>
注意: