1

I set up a project following the getting started guide. I have to use ivy. These are my dependencies:

    <dependencies>
    <dependency org="org.jboss.spec" name="jboss-javaee-all-6.0" rev="3.0.1.Final" conf="build->default" />

    <dependency org="org.jboss.arquillian.junit" name="arquillian-junit-container" rev="1.0.3.Final"  conf="test->default(*)" transitive="true"/>
    <dependency org="org.jboss.arquillian.junit" name="arquillian-junit-core" rev="1.0.3.Final"  conf="test->default(*)" transitive="true"/>

    <dependency org="org.jboss.weld.arquillian.container" name="arquillian-weld-ee-embedded-1.1" rev="1.1.2.Final" conf="test->default(*)" />
    <dependency org="org.jboss.weld" name="weld-core" rev="1.1.10.Final" conf="test->default(*)" />
    <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.6.4" conf="test->default(*)" />


</dependencies>

Problem: Although I map to "*", the deps are not resolved transitive. Do I have to add every single jar by hand, just because I am stuck with ivy? or am I missing something?

Clarification:

I use the mapping "myconf->default()" transitive="true". I read this as follows: "take the default conf of the dependency and map it to "myconf". (): if the dependeny does not provide "default", use every conf it provides. and all this should be done transitive, meaning every sub-dependency will also be mapped.

But what I get is: just the jars specified, and a lot of CNFE when I run the test. I read about arquillian-container poms that are referenced in maven projects and I am beginning to fear that there is no working "out of the box" dependency mapping mechanism for ivy and arquillian. I am happy Iif anyone can confirm this or provide a working (best: tested) dependency configuration that I can use. Thank you very much!

Jan Galinski
  • 11,768
  • 8
  • 54
  • 77
  • I did not thinks this could be misinterpretated, but still: I am aware of the configurations mechanism in ivy, I just posted my dependencies block, since it is not important for this issue where I MAP my deps, but where I GET them from ... I am not getting transitive right and I think it is due to some very maven specific POM configurations the JBoss guys use ... – Jan Galinski Nov 22 '12 at 16:50
  • I generally never use the transitive option at all because for Maven modules on can just map to the remote "default" or "master" configurations to enable and disable transitive dependencies. The second piece of possible confusion was the way you mapped the configurations: "test->default(*)". In the context of a Maven module you don't need the bracket syntax. Generally all ivy modules will have a "default" configuration. In conclusion I think you need to spell out exactly what transitive dependencies are missing – Mark O'Connor Nov 22 '12 at 17:06

1 Answers1

0

I'd recommend that your ivy file always declare a set of configurations. Configurations are the logical groupings of jars within your build.

The following example creates a configuration for the 3 classpaths used in a typical java build:

  • compile
  • runtime
  • test

(Note also the "extends" keyword)

<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.jboss.spec" name="jboss-javaee-all-6.0" rev="3.0.1.Final" conf="compile->default" />

        <!-- test dependencies -->
        <dependency org="org.jboss.arquillian.junit" name="arquillian-junit-container" rev="1.0.3.Final"  conf="test->default"/>
        <dependency org="org.jboss.arquillian.junit" name="arquillian-junit-core" rev="1.0.3.Final"  conf="test->default"/>
        <dependency org="org.jboss.weld.arquillian.container" name="arquillian-weld-ee-embedded-1.1" rev="1.1.2.Final" conf="test->default" />
        <dependency org="org.jboss.weld" name="weld-core" rev="1.1.10.Final" conf="test->default" />
        <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.6.4" conf="test->default" />
    </dependencies>

</ivy-module>

The configuration mappings will then map the local configuration to the remote one, as follows:

conf="compile->default"

The remote "default" configuration is normally all you need and will include the remote module's compilation dependencies. For a more detailed explanation of how Maven modules are translated I suggest reading the following answer:

Finally, your build file can use these configurations to create populated ANT classpaths:

<target name="init" description="Use ivy to resolve classpaths">
    <ivy:resolve/>

    <ivy:report todir='build/ivy' graph='false' xml='false'/>

    <ivy:cachepath pathid="compile.path" conf="compile"/>
    <ivy:cachepath pathid="runtime.path" conf="runtime"/>
    <ivy:cachepath pathid="test.path"    conf="test"/>
</target>

The "report" task is especially useful to document the versions of each jar on the classpath.

Community
  • 1
  • 1
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • 1
    I updated my question, this was not about ivy confs. Did you manage tu run arquillian tests with the setup you provided? – Jan Galinski Nov 22 '12 at 16:45
  • @JanGalinski The question comes across as an ivy question. Clearly your issue is that there are missing libraries associated with the arquillian project. I don't work with that code. If you list what's missing then someone can do some analysis for you. – Mark O'Connor Nov 22 '12 at 17:09