My dependencies.xml contains a lot of packages required for my web application to run
Following are a few notable fragments
<configurations>
<conf name="test" visibility="public" extends="compile" />
<conf name="compile" visibility="public" extends="runtime" />
<conf name="runtime" visibility="public" />
<conf name="provided" visibility="public" />
<conf name="junit" visibility="public" extends="test" />
</configurations>
<publications>
<artifact name="${project.name}" type="jar" ext="jar" conf="compile" />
<artifact name="${project.name}" type="zip" ext="zip" conf="compile"/>
</publications>
<dependencies>
<dependency org="org.hibernate" name="hibernate-core" rev="5.1.3.Final" transitive="false" conf="runtime->*"/>
<dependency org="org.hibernate" name="hibernate-ehcache" rev="5.1.3.Final" transitive="false" conf="runtime->*"/>
<dependency org="org.hibernate.common" name="hibernate-commons-annotations" rev="5.0.1.Final" transitive="false" conf="runtime->*"/>
<dependency org="org.hibernate.javax.persistence" name="hibernate-jpa-2.1-api" rev="1.0.0.Final" transitive="false" conf="runtime->*"/>
<dependency org="org.javassist" name="javassist" rev="3.21.0-GA" transitive="false" conf="runtime->*"/>
<dependency org="org.jboss.logging" name="jboss-logging" rev="3.3.0.Final" transitive="false" conf="runtime->*"/>
<dependency org="javax.transaction" name="jta" rev="1.1" transitive="false" conf="runtime->*"/>
<dependency org="net.sf.ehcache" name="ehcache-core" rev="2.6.11" transitive="false" conf="runtime->*"/>
<dependency org="antlr" name="antlr" rev="2.7.7" transitive="false" conf="runtime->*"/>
<dependency org="org.antlr" name="antlr4-runtime" rev="4.5.2-1" transitive="false" conf="runtime->*"/>
</dependencies>
I have package JTA from javax.transaction that is required for the application to run under Tomcat and forbidden for the application to run under WebSphere.
I need to know how to make two different WAR files depending on the target platform. I don't exactly know how to use configurations, if that is the way.
Ant will do an ivy-retrieve for configuration runtime and build a WAR archive using the jars downloaded from Artifactory.
I could exclude thos jar(s) manually by doing a delete after Ivy has resolved the artifacts, but hey, we are cool developers and we like to do the things the cleaner way.
How would you suggest me to do an ivy-retrieve that targets Tomcat including JTA an another that targets Websphere excluding it?
build.xml : Building war files
The following fragment builds two war files:
../demo.war
../demo-websphere.war
The magic is that the tomcat retrieve task includes two configurations:
<ivy:retrieve pattern="${lib.dir}/tomcat/[artifact].[ext]" conf="runtime,tomcat_only"/>
<war destfile="${dist.dir}/demo.war" webxml="${resources.dir}/web.xml">
<fileset dir="${resources.dir}" excludes="web.xml"/>
<lib dir="${lib.dir}/tomcat"/>
</war>
<ivy:retrieve pattern="${lib.dir}/websphere/[artifact].[ext]" conf="runtime"/>
<war destfile="${dist.dir}/demo-websphere.war" webxml="${resources.dir}/web.xml">
<fileset dir="${resources.dir}" excludes="web.xml"/>
<lib dir="${lib.dir}/websphere"/>
</war>
build.xml : Publishing
The following answer contains more details on publishing multiple module artifacts to a Maven repository
how to publish 3rdparty artifacts with ivy and nexus
So we need a target to generate the POM file:
<target name="prepare" description="Generate POM">
<!-- Optional: Intermediate file containing resolved version numbers -->
<ivy:deliver deliverpattern="${build.dir}/ivy.xml" pubrevision="${publish.revision}" status="release"/>
<!-- Generate the Maven POM -->
<ivy:makepom ivyfile="${build.dir}/ivy.xml" pomfile="${build.dir}/demo.pom"/>
</target>
And a second target that publish the built files:
<target name="publish" depends="init,prepare" description="Upload to Nexus">
<ivy:publish resolver="nexus-deploy" pubrevision="${publish.revision}" overwrite="true" publishivy="false" >
<artifacts pattern="${build.dir}/[artifact](-[classifier]).[ext]"/>
</ivy:publish>
</target>
Take careful notice of the optional "classifier" attribute and note how the ivy file is structured next
ivy.xml
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
<info organisation="com.myspotontheweb" module="demo"/>
<configurations>
<conf name="master"/>
<conf name="default" extends="master,runtime"/>
<conf name="compile"/>
<conf name="provided"/>
<conf name="runtime" extends="compile"/>
<conf name="test" extends="runtime"/>
<conf name="tomcat_only" description="A special configuration for special tomcat only dependencies"/>
</configurations>
<publications>
<artifact name="demo" type="war" conf="master"/>
<artifact name="demo" type="pom" conf="master"/>
<artifact name="demo" type="war" conf="master" e:classifier="websphere"/>
</publications>
<dependencies>
<!-- Compile dependencies -->
<dependency org="org.hibernate" name="hibernate-core" rev="5.1.3.Final" conf="compile->default"/>
<dependency org="org.api" name="slf4j-api" rev="1.7.22" conf="compile->default"/>
<!-- Runtime dependencies -->
<dependency org="org.slf4j" name="slf4j-log4j12" rev="1.7.22" conf="runtime->default"/>
<!-- Tomcat dependencies -->
<dependency org="javax.transaction" name="jta" rev="1.1" conf="tomcat_only->master"/>
</dependencies>
</ivy-module>
Few things going on here.
1)
Make configuration mappings work for you
config1->default # Remote artifact plus transitive dependencies
config2->master # Remote artifact only (Same as setting transitive=false)
2)
The "extends" attribute is a set operation, meaning a compile dependency is automatically included as a runtime configuration.
An example is the SLF4J libary. The slf4j-api jar is required when compile code, where as the slf4j-log4j12 jar contained bindings and dependencies on log4j, a runtime (and changeable) dependency.
3)
The "master" configuration in your module is special and by convention in Maven world corresponds to the files published by this module.
4)
The "classifier" attribute is an example of a extra attribute in ivy.
Related
Following is my ivy file :
<configurations>
<conf name="default" description="Default configuration"/>
<conf name="runtime" description="The configuration needed for runtime" extends="default"/>
<conf name="compile" description="The configuration needed to compile" extends="default"/>
<conf name="test" description="The configuration needed to run the tests" extends="compile"/>
<conf name="sources" description="Source files configuration"/>
</configurations>
<dependencies>
<dependency org="hibernate" name="hibernate" rev="3.5.3" conf="compile,runtime -> default"/>
<dependency org="org.apache.hive" name="hive-jdbc" rev="2.0.0" conf="compile,runtime -> default">
<artifact name="hive-jdbc" ext="jar"/>
<exclude module="mail" />
<exclude module="libthrift" />
</dependency>
</dependencies>
When connecting to hive I am getting the following error :
java.lang.IncompatibleClassChangeError: class org.apache.hive.service.cli.thrift.TCLIService$Client has interface org.apache.thrift.TServiceClient as super class
Can anyone please let me know what is the problem?
I need to build a custom Ant script that builds a project based on CI output. We use Atlassian Bamboo as CI server.
Normally our projects have a dependency to our platform module, managed via Ivy/Artifactory.
Our typical dependencies.xml file contains a dependency to that module, transitively. And other potential dependencies. As an example, our core module depends on lots of Spring packages, but not on Spring Boot. If a project needs Spring Boot too, it will define its dependency in its dependencies.xml file along with <depencency org="com.acme" name="core-platform"...
My goal now is to exclude com.acme#core-platform from resolution, because I am making a different task that uses Bamboo output artifact to take the latest build of the core module and its dependencies without going through Artifactory.
This is very important because during a build I may like to change the version of a dependent package (e.g. upgrade Spring 4.3.1 to 4.3.3) and test with the proper Spring. If I simply resolve dependencies to com.acme#core-platform#latest.release, which is released on Artifactory, I won't take 4.3.3 of Spring which was committed to Git and available in core-platform's currently-building dependencies.xml. I hope my explanation is easy to understand.
So let's say I have this dependency list as an example
com.acme#core-platform#${version}
org.hibernate#hibernate-java8#5.1.0.Final
org.springframework.boot#spring-boot-starter-web#1.3.1.RELEASE
commons-collections#commons-collections#3.2.2
.... others
Full dependency is
<dependencies>
<dependency org="com.acme" name="core-platform" rev="${version}" transitive="true" conf="runtime->runtime" changing="true"/>
<dependency org="com.acme" name="core-platform" rev="${version}" transitive="true" conf="compile->compile" changing="true"/>
<dependency org="com.acme" name="core-platform" rev="${version}" transitive="true" conf="provided->provided" changing="true"/>
<dependency org="com.acme" name="core-platform" rev="${version}" transitive="true" conf="junit->junit" changing="true"/>
<dependency org="com.acme" name="core-platform" rev="${version}" transitive="true" conf="test->test" changing="true"/>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-java8 -->
<dependency org="org.hibernate" name="hibernate-java8" rev="5.1.0.Final" transitive="false" />
<dependency org="org.springframework.boot" name="spring-boot-starter-web" rev="1.3.1.RELEASE" transitive="false" />
<dependency org="org.springframework.boot" name="spring-boot-starter-tomcat" rev="1.3.1.RELEASE" transitive="false" />
<dependency org="org.springframework.boot" name="spring-boot-starter-validation" rev="1.3.1.RELEASE" transitive="false" />
<dependency org="commons-collections" name="commons-collections" rev="3.2.2" transitive="false" />
<!-- jackson2 libs -->
<dependency org="com.fasterxml.jackson.datatype" name="jackson-datatype-jdk8" rev="2.8.1" transitive="false" conf="runtime->*"/>
<dependency org="com.fasterxml.jackson.datatype" name="jackson-datatype-jsr310" rev="2.8.1" transitive="false" conf="runtime->*"/>
<exclude module="joda-time" />
<exclude module="jackson-datatype-joda" />
</dependencies>
I simply want to take Hibernates' Java8, commons-collections, etc.
Creating a duplicate dependencies.xml is not an option
I was considering manipulating the dependencies.xml via Ant and have it exclude the acme modules by regex. Feasible but tricky
Unfortunately I can't combine Ant task's ivy:retrieve with attributes file and element exclude, because that would have helped a looooooot
Any ideas?
It is hard to understand your requirement. I suspect that your problem could be solved by creating an additional configuration and use configuration mappings to control the downloads.
Example
This build creates two directories. The first contains the log4j dependency without transitive dependencies, the second includes the remote module's optional dependencies. If you look at the remote POM you'll see they have a different scope.
├── build.xml
├── ivy.xml
├── lib1
│ └── log4j-1.2.17.jar
└── lib2
├── activation-1.1.jar
├── geronimo-jms_1.1_spec-1.0.jar
├── log4j-1.2.17.jar
└── mail-1.4.3.jar
build.xml
<project name="demo" default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="resolve">
<ivy:resolve/>
<ivy:retrieve pattern="lib1/[artifact]-[revision](-[classifier]).[ext]" conf="noDependencies"/>
<ivy:retrieve pattern="lib2/[artifact]-[revision](-[classifier]).[ext]" conf="withDependencies"/>
</target>
</project>
Notes:
Each "retrieve" task creates a directory containing the files that make up the configuration.
ivy.xml
<ivy-module version="2.0">
<info organisation="com.myspotontheweb" module="demo"/>
<configurations>
<conf name="noDependencies" description="File grouping that has no transitive dependencies"/>
<conf name="withDependencies" description="File grouping that contains dependencies"/>
</configurations>
<dependencies>
<dependency org="log4j" name="log4j" rev="1.2.17" conf="noDependencies->master; withDependencies->master,optional"/>
</dependencies>
</ivy-module>
Notes:
Note how the configuration is declared at the top of the ivy file and the dependency contains two configuration mappings
Additional
The following answer explains how ivy interprets Maven modules. It creates configurations that can be used to decide which files should be downloaded:
How are maven scopes mapped to ivy configurations by ivy
Ok, looks like the replace trick is very easy too.
Add the following markers <!-- DEPS START --> and <!-- DEPS END --> (or any of choice) between the parts of the dependencies.xml file to ignore
Hack via Ant
<copy file="dependencies.xml" tofile="ci/hacked-dependencies.xml" overwrite="true">
<filterchain>
<replacestring from="<!-- DEPS START -->" to="<!--" />
<replacestring from="<!-- DEPS END -->" to="-->" />
</filterchain>
</copy>
Example
<!-- DEPS START -->
<dependency org="com.acme" name="core-platfrom" rev="${version}" transitive="true" conf="runtime->runtime"/>
<!-- DEPS END -->
I have an ivy.xml file (without an ivysettings.xml file) with the following dependency:
<dependency org="org.freemarker" name="freemarker" rev="2.3.23"/>
However when I resolve my ivy dependencies I end up with freemarker-2.3.8.jar and freemarker-2.3.23.jar. This is causing a problem in Apache Tomcat because the 2.3.8.jar is taking precedence over 2.3.23.jar and a static final int called Configuration.VERSION_2_3_23 is showing up at run-time as unavailable (though it is available a compile time). Here is the full ivy.xml in case it helps:
<ivy-module version="2.0">
<info organisation="com.example" module="ExampleProject"/>
<configurations defaultconfmapping="default">
<conf name="default"/>
<conf name="java8" extends="default" description="Java 8 dependencies"/>
<conf name="eclipse" description="Special dependencies in Eclipse"/>
<conf name="utest" extends="eclipse" description="Unit testing dependencies"/>
</configurations>
<dependencies>
<dependency org="com.amazonaws" name="aws-java-sdk-s3" rev="1.10.6"/>
<dependency org="org.slf4j" name="slf4j-simple" rev="1.7.10" />
<dependency org="org.lesscss" name="lesscss" rev="1.7.0.1.1"/>
<dependency org="com.github.mfornos" name="humanize-slim" rev="1.2.1"/>
<dependency org="com.google.code.gson" name="gson" rev="2.3.1"/>
<dependency org="com.lambdaworks" name="scrypt" rev="1.4.0"/>
<dependency org="commons-cli" name="commons-cli" rev="1.2"/>
<dependency org="commons-codec" name="commons-codec" rev="1.10"/>
<dependency org="commons-fileupload" name="commons-fileupload" rev="1.3.1"/>
<dependency org="joda-time" name="joda-time" rev="2.8.1"/>
<dependency org="mysql" name="mysql-connector-java" rev="5.1.36"/>
<dependency org="org.apache.ant" name="ant" rev="1.9.6"/>
<dependency org="org.apache.commons" name="commons-lang3" rev="3.4"/>
<dependency org="org.apache.httpcomponents" name="httpclient" rev="4.5"/>
<dependency org="org.freemarker" name="freemarker" rev="2.3.23"/>
<dependency org="org.hibernate" name="hibernate-c3p0" rev="4.3.10.Final"/>
<dependency org="org.hibernate" name="hibernate-core" rev="4.3.10.Final"/>
<dependency org="org.hibernate" name="hibernate-search" rev="4.5.1.Final"/>
<dependency org="org.hibernate" name="hibernate-tools" rev="4.3.1.CR1"/>
<dependency org="org.imgscalr" name="imgscalr-lib" rev="4.2"/>
<dependency org="org.jadira.usertype" name="usertype.core" rev="3.1.0.GA"/>
<dependency org="org.jsoup" name="jsoup" rev="1.8.3"/>
<dependency org="org.projectlombok" name="lombok" rev="1.16.6" />
<dependency org="org.tuckey" name="urlrewritefilter" rev="4.0.4"/>
</dependencies>
</ivy-module>
"freemarker-2.3.8.jar" is part of the "freemarker:freemarker" module and is a transitive dependency of
<dependency org="org.hibernate" name="hibernate-tools" rev="4.3.1.CR1"/>
I would recommend the following fix, telling ivy to exclude the unwanted module:
<ivy-module version="2.0">
..
..
<dependencies>
..
..
<exclude org="freemarker" module="freemarker"/>
</dependencies>
</ivy-module>
To help diagnose this problem I used the report task to analyse the content of each ivy configuration.
<project name="demo" default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="resolve">
<ivy:retrieve pattern="lib/[conf]/[artifact]-[revision](-[classifier]).[ext]"/>
<ivy:report todir="reports" graph="false"/>
</target>
</project>
Not sure if I'm going about this the right way, but I have some artifacts that I'm trying to convert to maven using ivy ant tasks and push into my maven repo.
the component in question is mystuff.services.common.
First I make the pom...
<ivy:makepom ivyfile="${ivy.lib.dir}/ivy/cache/myorg/mystuff.services.common/ivy-mystuff.services.common.xml" pomfile="${ivy.lib.dir}/ivy/cache/myorg/mystuff.services.common/poms/mystuff.services.common.pom">
<mapping conf="default" scope="compile"/>
<mapping conf="runtime" scope="runtime"/>
</ivy:makepom>
Then a little hackery - I insert an artifact element in the ivy file using xml task. This works ok...
<xmltask source="${ivy.lib.dir}/ivy/cache/myorg/mystuff.services.common/ivy-${resolved.revision}.xml" dest="${ivy.lib.dir}/ivy/cache/myorg/mystuff.services.common/ivy-${resolved.revision}.xml">
<insert path="/ivy-module/publications" >
<![CDATA[
<artifact name="mystuff.services.common" type="pom"/>
]]>
</insert>
</xmltask>
Then I resolve/deliver/publish, as per various docs I've seen on how to do this.
<ivy:resolve file="${ivy.lib.dir}/ivy/cache/myorg/mystuff.services.common/ivy-${resolved.revision}.xml"/>
<!--<echoproperties/>-->
<ivy:deliver conf="*" delivertarget="recursive-deliver"/>
<ivy:publish resolver="myrepo-publish" publishivy="false" overwrite="true">
<artifacts pattern="lib/myorg/[module]/[type]s/[artifact].[ext]"/>
</ivy:publish>
And the error I get:
build.xml:235: impossible to publish artifacts for
myorg#mystuff.services.common;1.0.1: java.io.IOException: missing artifact
myorg#mystuff.services.common;1.0.1!mystuff.services.common.pom
If I leave out the pom from the artifacts in the ivy file, the other artifacts just publish fine.
What am I doing wrong?
This is what the ivy file looks like after inserting the pom entry for artifacts
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../../ivy-doc.xsl"?>
<ivy-module version="1.0">
<info organisation="myorg" module="mystuff.services.common" revision="1.0.1" status="integration" publication="20130206204156"/>
<configurations>
<conf name="default"/>
<conf name="compile" extends="default"/>
</configurations>
<publications>
<artifact name="services.common" type="jar" conf="compile"/>
<artifact name="services.common~test" type="jar" conf="compile"/>
<artifact name="services.common" type="javadoc-zip" ext="zip" conf="compile"/>
<artifact name="services.common~test" type="javadoc-zip" ext="zip" conf="compile"/>
<artifact name="services.common" type="src-zip" ext="zip" conf="compile"/>
<artifact name="services.common~test" type="src-zip" ext="zip" conf="compile"/>
<artifact name="com.myorg.mystuffservices.common" type="osgi-module" ext="jar" conf="compile"/>
<artifact name="services.common" type="pom"/>
</publications>
<dependencies>
<dependency org="org.testng" name="testng" rev="5.11" conf="compile->compile-15"/>
</dependencies>
</ivy-module>
Your publish does not have an artifact pattern that finds the pom generated by your "makepom" task.
Either change the location or alternatively add an extra artifacts tag to your publish task:
<ivy:publish resolver="myrepo-publish" publishivy="false" overwrite="true">
<artifacts pattern="lib/myorg/[module]/[type]s/[artifact].[ext]"/>
<artifacts pattern="${ivy.lib.dir}/ivy/cache/myorg/mystuff.services.common/poms/mystuff.services.common.pom"/>
</ivy:publish>
I also don't understand why you're inserting a POM entry into you ivy file. Why don't you just list in your publications section?
For a detailed example see:
how to publish 3rdparty artifacts with ivy and nexus
I'm using Ivy on my project, with the Ivy Eclipse plugin.
It appears that certain jars which are downloaded and added to my project are the javadoc jars, not the jars with the actual code. Note - this doesn't happen with all jars.
For example, adding this to my ivy.xml file:
<dependency org="junit" name="junit" rev="4.8.2"/>
caused the javadocs for junit to be downloaded and added to my classpath:
This breaks compilation for my project, as none of the unit tests are working.
This was working fine until I added a reference to Spring, and everything broke. I've tried removing the reference, and deleting junit from my local cache to force ivy to fetch it again, but the problem persists.
Here's my total dependency block (with spring removed):
<dependencies>
<dependency org="org.hamcrest" name="hamcrest-library" rev="1.3.RC2"/>
<dependency org="junit" name="junit" rev="4.8.2"/>
<dependency org="org.mockito" name="mockito-core" rev="1.8.5"/>
<dependency org="javax.persistence" name="persistence-api" rev="1.0"/>
</dependencies>
Here's my ivysettings.xml for the project:
<ivysettings>
<caches artifactPattern="[organisation]/[module]/[revision]/[artifact].[ext]" />
<settings defaultResolver="local.ibiblio.jboss.java-net.springsource" checkUpToDate="true" />
<resolvers>
<chain name="local.ibiblio.jboss.java-net.springsource">
<filesystem name="libraries">
<artifact pattern="${basedir}/ivy-repo/[artifact]-[revision].[type]" />
</filesystem>
<ibiblio name="ibiblio" m2compatible="true" />
<ibiblio name="jboss" m2compatible="true"
root="https://repository.jboss.org/nexus/content/groups/public-jboss" />
<ibiblio name="java.net" m2compatible="true"
root="https://repository.jboss.org/nexus/content/repositories/java.net-m2/" />
<ibiblio name="java.net" m2compatible="true"
root="http://repository.codehaus.org/" />
<url name="com.springsource.repository.libraries.release">
<ivy pattern="http://repository.springsource.com/ivy/libraries/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact pattern="http://repository.springsource.com/ivy/libraries/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<url name="com.springsource.repository.libraries.external">
<ivy pattern="http://repository.springsource.com/ivy/libraries/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact pattern="http://repository.springsource.com/ivy/libraries/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<url name="com.springsource.repository.bundles.release">
<ivy pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<url name="com.springsource.repository.bundles.external">
<ivy pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
</chain>
</resolvers>
</ivysettings>
Some open source modules include optional java doc jars. To remove them add a configuration mapping to each of your dependencies:
<dependency org="junit" name="junit" rev="4.8.2" conf="default"/>
The default configuration in ivy is equivalent to the the compile scope in a maven module. This is how the optional libraries can be automatically omitted. (Check their POMs).
A better approach is to declare your own configurations and the default mapping as follows:
<configurations defaultconfmapping="compile->default">
<conf name="compile" description="Required to compile code"/>
<conf name="test" description="Additional test dependencies" extends="compile" />
</configurations>
Then in your ivy file you only need to declare the non-standard configurations:
<dependencies>
<dependency org="org.hamcrest" name="hamcrest-library" rev="1.3.RC2" conf="test->default"/>
<dependency org="junit" name="junit" rev="4.8.2" conf="test->default"/>
<dependency org="org.mockito" name="mockito-core" rev="1.8.5" conf="test->default"/>
<dependency org="javax.persistence" name="persistence-api" rev="1.0"/>
</dependencies>
In this case we only want the 3 test libraries to appear on the test configuration.
Still confused? The magic of ivy configurations is when you use them to manage your build's class path
<target name='dependencies' description='Resolve project dependencies and set classpaths'>
<ivy:resolve/>
<ivy:cachepath pathid="compile.path" conf="compile"/>
<ivy:cachepath pathid="test.path" conf="test"/>
</target>
This is what Maven is doing when you declare a scope tag on a dependency, for example:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
The scopes in Maven are fixed. In ivy you can have as many as you need.