0

I have two projects, app1 and app2.

app2 depends on app1(app2->app1).

app1's build.xml is like

<target name="deploy" depends="jar">
        <ivy:deliver deliverpattern="${build.dir}/ivy.xml" pubrevision="${ivy.revision}" status="release" />
        <ivy:makepom ivyfile="${build.dir}/ivy.xml" pomfile="${build.dir}/${ivy.module}.pom" />
        <ivy:resolve />
        <ivy:publish resolver="nexus-snapshots" pubrevision="${ivy.revision}" overwrite="true" publishivy="false">
            <artifacts pattern="${build.dir}/[artifact].[ext]" />
        </ivy:publish>
    </target>

app1's ivy.xml is like this

<ivy-module version="2.0">
    <info organisation="the.bhushan" module="app1" revision="1.0-SNAPSHOT" />
    <publications>
        <artifact name="app1" type="jar" />
        <artifact name="app1" type="pom" />
    </publications>
    <dependencies>
        <dependency org="commons-cli" name="commons-cli" rev="1.0" />
        <dependency org="net.lingala.zip4j" name="zip4j" rev="1.3.1" />
    </dependencies>
</ivy-module>

app2's ivy.xml is like

<ivy-module version="2.0">
    <info organisation="the.bhushan" module="app2" revision="1.0-SNAPSHOT" />
    <configurations>
        <conf name="compile" visibility="public" />
    </configurations>
    <dependencies>
        <dependency org="the.bhushan" name="app1" rev="1.0-SNAPSHOT" />
    </dependencies>
</ivy-module>

Now the problem is that, in app2 transient dependencies are not getting retrieve(ie commons-cli and zip4j).

Update: I looked at pom created by app1. In that, all dependencies have <optional>true</optional> element.

Bhushan
  • 1,489
  • 3
  • 27
  • 45
  • I recommend using configuration mappings in your ivy file. Not only is this good practice it allows you to explicitly decide the Maven scope of dependencies that appear in the POM file. – Mark O'Connor May 28 '16 at 10:42
  • I can also recommend the following that helps understand the relationship between ivy configurations and Maven scopes: http://stackoverflow.com/questions/7104364/how-are-maven-scopes-mapped-to-ivy-configurations-by-ivy/7116577#7116577 – Mark O'Connor May 28 '16 at 10:43
  • 1
    The following does not publish to Maven but does demonstrate how to setup configurations that emulate Maven scopes: http://stackoverflow.com/questions/37420103/ant-ivy-conf-specific-retrieve-is-failing-on-my-published-jar/37448964#37448964 – Mark O'Connor May 28 '16 at 10:47

0 Answers0