Resolve two artifacts in same dependency using ivy

I’m having trouble resolving kafka dependencies using ivy.

I am trying to create a kafka server in a junit test.

TestUtils.createServer(kafkaConfig, Time.SYSTEM);

This requires kafka_2.11-0.10.2.1.jar, kafka-clients-0.10.2.1-test.jar, and kafka_2.11-0.2.1-test.jar to be on the test class path since kafka.utils.TestUtils is in the *-test.jar. The problem is how can I resolve the *-test.jar using ivy and ant? In the ivy.xml I have:

<configurations defaultconfigmapping="default>
    <conf name="compile"/>
    <conf name="test" extends="compile"/>
    <conf name="master"/>
    <conf name="sources"/>
    <conf name="javadoc"/>
    <conf name="runtime" extends="compile"/>
    <conf name="default" extends="master,runtime"/>
</configurations>
...
    <dependency org="org.apache.kafka" name="kafka-clients" rev="0.10.2.1" conf="compile->default"/>
    <dependency org="org.apache.kafka" name="kafka_2.11" rev="0.10.2.1" conf="test->default">
        <artifact name="kafka_2.11" ext="jar"/>
        <artifact name="kafka_2.11" e:classifier="test" ext="jar"/>
    </dependency>
    <dependency org="org.apache.kafka" name="kafka-clients" rev="0.10.2.1" conf="test->default">
        <artifact name="kafka-clients" ext="jar"/>
        <artifact name="kafka-clients" e:classifier="test" ext="jar"/>
    </dependency>

The build has something similar this

<ivy:resolve log="quiet" conf="compile" transitive="false"/>
<ivy:cachepth pathid="test-classpath" conf="test" log="quiet"/>

This results in NoClassDefFoundError org/apache/kafka/test/TestUtils.

I noticed that conf is set to “compile” but when I add test to the list I get other errors for missing classes.