ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mansour Al Akeel <mansour.alak...@gmail.com>
Subject Transitive dependencies
Date Sat, 11 Feb 2012 15:38:05 GMT
Hello all,

I have been trying to resolve this issue, for sometime, but no luck. I
consider myself IVY newbie. 

I have two projects. The first one is an ant task that helps building
and deploying the second project. I need to deploy and use this from
maven repo. This part is working fine, but the problem with the
transitive dependencies. 

For the first project (the relevant parts): 
ivysettings.xml:
==============
<?xml version="1.0"?>
<ivysettings>
    <settings defaultResolver="default"/>
    <resolvers>
    	<ibiblio name="public" m2compatible="true" />
    	<filesystem name="local-maven2" m2compatible="true">
    	    <artifact
    		pattern="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
    	</filesystem>
    	<chain name="default" >
    	    <resolver ref="public"/>
    	    <resolver ref="local-maven2"/>
    	</chain>
    </resolvers>
</ivysettings>

ivy.xml:
========
<ivy-module version="2.0">
    <info organisation="com.example" module="ant-openejb" revision="1.0"/>
    <configurations defaultconfmapping="default->runtime">
    	<conf name="default" />
    	<conf name="compile" />
    </configurations>
    <publications>
        <artifact type="jar" ext="jar"/>
        <artifact type="descriptor" ext="pom"/>
    </publications>
    <dependencies>
	<dependency org="org.apache.ant" name="ant" rev="1.8.2" conf="default->compile"/>
	<dependency org="org.apache.openejb" name="openejb-server" rev="4.0.0-beta-2" conf="default->compile"
/>
    </dependencies>
</ivy-module>

Ant tasks to install:
=====================
    <target name="ivy" description="--> retrieve dependencies with ivy">
	<ivy:retrieve pattern="lib/[conf]/[artifact]-[revision].[ext]" type="jar" />
    </target>

    <target name="install" depends="ivy" description="publish jar/source to maven repo
mounted at ~/.m2/repository">
	<ivy:makepom ivyfile="ivy.xml" 
		     pomfile="target/ant-openejb.pom">
	    <mapping conf="default" scope="compile"/>
	</ivy:makepom>
	<ivy:publish resolver="local-maven2"
		     conf="default"
		     forcedeliver="true" overwrite="true" publishivy="true">
	    <ivy:artifacts pattern="target/[artifact].[ext]"/>
	</ivy:publish>
    </target>

The generated pom file:
======================
<?xml version="1.0" encoding="UTF-8"?>
<!--
   Apache Maven 2 POM generated by Apache Ivy
   http://ant.apache.org/ivy/
   Apache Ivy version: 2.2.0 20100923230623
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>ant-openejb</artifactId>
  <packaging>jar</packaging>
  <version>1.0</version>
  <dependencies>
    <dependency>
      <groupId>org.apache.ant</groupId>
      <artifactId>ant</artifactId>
      <version>1.8.2</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.openejb</groupId>
      <artifactId>openejb-server</artifactId>
      <version>4.0.0-beta-2</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>


Now for the second project, I am trying to retrieve the artifact
published by the first project with it's dependencies. The only
dependecy I get is one declared in ivy.xml.

ivysettings.xml
=================

<?xml version="1.0"?>
<ivysettings>
    <settings defaultResolver="default"/>
    <resolvers>
        <ibiblio name="public" m2compatible="true" />
        <ibiblio name="local-maven2" m2compatible="true" root="file://${user.home}/.m2/repository"
/>
        <chain name="default" >
            <resolver ref="local-maven2"/>
            <resolver ref="public"/>
        </chain>
    </resolvers>
</ivysettings>


ivy.xml:
========
<ivy-module version="2.0">
    <info organisation="com.example" module="book" revision="1.0"/>
    <dependencies>
        <dependency org="com.example" name="ant-openejb" rev="1.0" />
    </dependencies>
</ivy-module>


Ant task:
========
    <target name="depend" description="--> retrieve dependencies with ivy">
        <ivy:retrieve pattern="lib/[conf]/[artifact]-[revision].[ext]" type="jar" />
    </target>


What I am doing wrong ?  Any advice ?

Thank you in advance.





Mime
View raw message