Reputation: 4616
Using apache ivy I want to download jcs 1.3 jar file but I don't want rest of the transient dependencies which comes with it. Is there anyway I can specify ivy to exclude all transient dependencies for this particular dependency element? Or at least use wildcard in the exclusion pattern?
I have looked for Ivy documentation and couldn't find any example on how to use matcher for glob/regex pattern for excluding files.
Following is the snippet of my ivy.xml and I want to avoid long list of excluded name/modules.
<dependency org="jcs" name="jcs" rev="1.3" conf="*->*,!sources,!javadoc">
<exclude name='ant-optional' />
<exclude name='avalon-framework' />
<exclude name='berkeleydb' />
<exclude name='commons-beanutils' />
<exclude name='commons-beanutils-core' />
<exclude name='commons-codec' />
<exclude name='commons-collections' />
<exclude name='commons-configuration' />
<exclude name='commons-dbcp' />
<exclude name='commons-digester' />
<exclude name='commons-jxpath' />
<exclude name='commons-lang' />
<exclude name='commons-logging' />
<exclude name='commons-logging-api' />
<exclude name='commons-pool' />
<exclude name='concurrent' />
<exclude name='hsqldb' />
<exclude name='jdom' />
<exclude name='junit' />
<exclude name='jdbc-stdext' />
<exclude name='jta' />
<exclude name='log4j' />
<exclude name='logkit' />
<exclude name='mysql-connector-java' />
<exclude name='oro' />
<exclude name='servlet-api' />
<exclude name='tomcat-util' />
<exclude name='velocity' />
<exclude name='xerces' />
<exclude name='xercesImpl' />
<exclude name='xmlrpc' />
</dependency>
Upvotes: 0
Views: 1731
Reputation: 77951
It's actually a lot simpler, using configuration mappings. Here's the example:
<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="jcs" name="jcs" rev="1.3" conf="compile->master"/>
</dependencies>
</ivy-module>
The magic bit is the following mapping:
compile->master
The following answer explains in more detail how ivy interprets Maven modules:
How are maven scopes mapped to ivy configurations by ivy
master contains only the artifact published by this module itself, with no transitive dependencies
Using configurations is a powerful feature. The cachepath task can be used to populate ANT paths:
<ivy:cachepath pathid="compile.path" conf="compile"/>
<ivy:cachepath pathid="test.path" conf="test"/>
Upvotes: 1