Apvy Ivy and configurations

I use Ivy to manage my addictions, with some problems with the provided banks

This is my ivy.xml file

<configurations>
    <conf name="local" visibility="private" />
    <conf name="compile" description="used for building" />
    <conf name="test" extends="compile" description="used for testing" />
    <conf name="runtime" description="used for running" />
    <conf name="master" description="used for publishing" />
    <conf name="default" extends="master, runtime" />
</configurations>
<dependencies>
    <dependency org="xalan" name="xalan" rev="2.7.1"/>
    <dependency org="org.w3c.css" name="sac" rev="1.3"/>
    <dependency org="com.lowagie" name="itext" rev="2.0.8">
            <exclude org="bouncycastle"/>
    </dependency>
<!--Provided-->
<dependency org="javax.ejb" name="ejb-api" rev="3.0" conf="compile"/>
<dependency org="javax.jms" name="jms-api" rev="1.1-rev-1" conf="compile"/>
</dependencies>

Ejb and jms are provided by the container

Running affiliate I get

---------------------------------------------------------------------
|                  |            modules            ||   artifacts   |
|       conf       | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
|      compile     |   8   |   0   |   0   |   0   ||   6   |   0   |
|      default     |   6   |   0   |   0   |   0   ||   6   |   0   |
---------------------------------------------------------------------

So, Ivy's all dependent on dependencies, but when I do this

<ivy:cachepath pathid="normal.classpath" />
<pathconvert property="expanded.normal.classpath" refid="normal.classpath"/>
<echo message="${expanded.normal.classpath}" file="normal.classpath.txt"/>

<ivy:cachepath conf="compile" pathid="compile.classpath" />
<pathconvert property="expanded.compile.classpath" refid="compile.classpath"/>
<echo message="${expanded.compile.classpath}" file="compile.classpath.txt"/>

Both class paths are the same. Does anyone know why?

0
source share
2 answers

The first one ivy:cachepathdoes not have conf conf, it allows all configurations, so each module is enabled.

ivy:cachepath conf. , , , conf="compile" ( conf="compile->compile"). - conf , conf *->*.

:

0

, .

<ivy-module version="2.0">
  <info organisation="com.myspotontheweb" module="demo"/>
  <configurations>
    <conf name="compile" description="used for building"/>
    <conf name="runtime" description="used for running" extends="compile"/>
    <conf name="test"    description="used for testing" extends="runtime"/>
  </configurations>
  <dependencies>
    <!-- compile dependencies -->
    <dependency org="javax.ejb" name="ejb-api" rev="3.0" conf="compile->default"/>
    <dependency org="javax.jms" name="jms-api" rev="1.1-rev-1" conf="compile->default"/>

    <!-- runtime dependencies -->
    <dependency org="xalan" name="xalan" rev="2.7.1" conf="runtime->default"/>
    <dependency org="org.w3c.css" name="sac" rev="1.3" conf="runtime->default"/>
    <dependency org="com.lowagie" name="itext" rev="2.0.8" conf="runtime->default">
      <exclude org="bouncycastle"/>
    </dependency>
  </dependencies>
</ivy-module>

:

---------------------------------------------------------------------
|                  |            modules            ||   artifacts   |
|       conf       | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
|      compile     |   2   |   2   |   2   |   0   ||   2   |   2   |
|      runtime     |   7   |   7   |   7   |   0   ||   7   |   7   |
|       test       |   7   |   7   |   7   |   0   ||   7   |   7   |
---------------------------------------------------------------------

, 2 ( ), (, ). , 3 , ANT build.

, . cleancache , .

report ivy .

<project name="demo" default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">

    <target name="resolve" 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="test.path"    conf="test"/>
    </target>

    <target name="clean">
        <delete dir="build"/>
    </target>

    <target name="clean-all" depends="clean">
        <ivy:cleancache/>
    </target>

</project>
0

Source: https://habr.com/ru/post/1748117/


All Articles