You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Not Zippy <no...@gmail.com> on 2012/10/16 23:15:31 UTC

Optional dependencies

Hi

For some reason I hadn't noticed till now that when I used ant + ivy to
build my POMS that it created all the dependencies as "optional"
ie
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.2</version>
      <optional>true</optional>
    </dependency>

My ivy.xml looks like
<ivy-module version="1.0">
    <info
        organisation="xxx"
        module="ext-dx"
        status="integration"/>
    <configurations defaultconf="main">
      <conf name="core" visibility="private" />
      <conf name="common" extends="core" />
      <conf name="main" extends="core" />
      <conf name="default" extends="main" />
      <conf name="resource" extends="core" />
      <conf name="hidden" extends="core" />
      <conf name="test" extends="common" />
    </configurations>
    <publications>
      <artifact name="ext-dx" type="jar" conf="main"/>
      <artifact name="ext-dx" type="pom" conf="main"/>
      <artifact name="ext-dx-resource" type="zip" ext="zip" conf="main"/>
      <artifact name="ext-dx-sources" type="source" ext="jar" conf="main"/>
    </publications>
    <dependencies>
        <dependency conf="main->default" org="commons-io" name="commons-io"
rev="2.2"/>
....

Make pom is
    <ivy:makepom ivyfile="${basedir}/ivy.xml"
                 conf="default"
                 pomfile="${build.dir}/${artifact.name}.pom">
     <mapping conf="default" scope="compile"/>
     <mapping conf="default" scope="runtime"/>
    </ivy:makepom>

Anyone have idea why ? Can't see anything about it in the docs...

THANKS
nZ

Re: Optional dependencies

Posted by Matt Benson <gu...@gmail.com>.
No problem... you do understand the maven scopes, and that "runtime"
means that none of the associated dependencies will pull transitively?
 (unless I am mistaken)

Matt

On Tue, Oct 16, 2012 at 5:24 PM, Not Zippy <no...@gmail.com> wrote:
> Palm to face.
>
> I had two separate makepom in the build script and was modifying the wrong
> one, this worked fine
>
>
>     <ivy:makepom ivyfile="${basedir}/ivy.xml"
>                  conf="main,test"
>
>                  pomfile="${build.dir}/${artifact.name}.pom">
>      <mapping conf="main" scope="runtime"/>
>     </ivy:makepom>
>
> Sorry, appreciated your answers though
> NxyzzzzzZZZZzzzz
>
>
> On Tue, Oct 16, 2012 at 3:16 PM, Matt Benson <gu...@gmail.com> wrote:
>>
>> I don't know why they're going to "optional" but why would you map
>> "main" to two different maven scopes, and what would you have expected
>> as a result?  AFAIK a given artifact/classifier combination can only
>> be in one Maven scope.  Presumably you want "main" to map to
>> "compile"...
>>
>> Matt
>>
>> On Tue, Oct 16, 2012 at 5:13 PM, Not Zippy <no...@gmail.com> wrote:
>> > Originally I had tried this :
>> >
>> >      <mapping conf="main" scope="compile"/>
>> >      <mapping conf="main" scope="runtime"/>
>> >
>> > and still the dependencies showed up as optional in the POM. Any other
>> > thoughts ?
>> >
>> > thanks
>> > Nz
>> >
>> >
>> > On Tue, Oct 16, 2012 at 3:02 PM, Matt Benson <gu...@gmail.com>
>> > wrote:
>> >>
>> >> Yes, the conf attribute should not be a mapping; rather it should just
>> >> be the name of one of your local configurations.
>> >>
>> >> Matt
>> >>
>> >> On Tue, Oct 16, 2012 at 4:49 PM, Not Zippy <no...@gmail.com> wrote:
>> >> > I have set the mapping
>> >> >
>> >> >     <ivy:makepom ivyfile="${basedir}/ivy.xml"
>> >> >                  conf="default"
>> >> >                  pomfile="${build.dir}/${artifact.name}.pom">
>> >> >      <mapping conf="main->default" scope="compile"/>
>> >> >      <mapping conf="main->default" scope="runtime"/>
>> >> >     </ivy:makepom>
>> >> >
>> >> > It still generates the POM with optional dependencies.
>> >> >
>> >> > thanks
>> >> > Nz
>> >> >
>> >> >
>> >> > On Tue, Oct 16, 2012 at 2:20 PM, Matt Benson <gu...@gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> You should be able to control this by using <mapping> elements
>> >> >> nested
>> >> >> into <makepom>.
>> >> >>
>> >> >> Matt
>> >> >>
>> >> >> On Tue, Oct 16, 2012 at 4:15 PM, Not Zippy <no...@gmail.com>
>> >> >> wrote:
>> >> >> > Hi
>> >> >> >
>> >> >> > For some reason I hadn't noticed till now that when I used ant +
>> >> >> > ivy
>> >> >> > to
>> >> >> > build my POMS that it created all the dependencies as "optional"
>> >> >> > ie
>> >> >> >     <dependency>
>> >> >> >       <groupId>commons-io</groupId>
>> >> >> >       <artifactId>commons-io</artifactId>
>> >> >> >       <version>2.2</version>
>> >> >> >       <optional>true</optional>
>> >> >> >     </dependency>
>> >> >> >
>> >> >> > My ivy.xml looks like
>> >> >> > <ivy-module version="1.0">
>> >> >> >     <info
>> >> >> >         organisation="xxx"
>> >> >> >         module="ext-dx"
>> >> >> >         status="integration"/>
>> >> >> >     <configurations defaultconf="main">
>> >> >> >       <conf name="core" visibility="private" />
>> >> >> >       <conf name="common" extends="core" />
>> >> >> >       <conf name="main" extends="core" />
>> >> >> >       <conf name="default" extends="main" />
>> >> >> >       <conf name="resource" extends="core" />
>> >> >> >       <conf name="hidden" extends="core" />
>> >> >> >       <conf name="test" extends="common" />
>> >> >> >     </configurations>
>> >> >> >     <publications>
>> >> >> >       <artifact name="ext-dx" type="jar" conf="main"/>
>> >> >> >       <artifact name="ext-dx" type="pom" conf="main"/>
>> >> >> >       <artifact name="ext-dx-resource" type="zip" ext="zip"
>> >> >> > conf="main"/>
>> >> >> >       <artifact name="ext-dx-sources" type="source" ext="jar"
>> >> >> > conf="main"/>
>> >> >> >     </publications>
>> >> >> >     <dependencies>
>> >> >> >         <dependency conf="main->default" org="commons-io"
>> >> >> > name="commons-io"
>> >> >> > rev="2.2"/>
>> >> >> > ....
>> >> >> >
>> >> >> > Make pom is
>> >> >> >     <ivy:makepom ivyfile="${basedir}/ivy.xml"
>> >> >> >                  conf="default"
>> >> >> >                  pomfile="${build.dir}/${artifact.name}.pom">
>> >> >> >      <mapping conf="default" scope="compile"/>
>> >> >> >      <mapping conf="default" scope="runtime"/>
>> >> >> >     </ivy:makepom>
>> >> >> >
>> >> >> > Anyone have idea why ? Can't see anything about it in the docs...
>> >> >> >
>> >> >> > THANKS
>> >> >> > nZ
>> >> >
>> >> >
>> >
>> >
>
>

Re: Optional dependencies

Posted by Not Zippy <no...@gmail.com>.
Palm to face.

I had two separate makepom in the build script and was modifying the wrong
one, this worked fine

    <ivy:makepom ivyfile="${basedir}/ivy.xml"
                 conf="main,test"
                 pomfile="${build.dir}/${artifact.name}.pom">
     <mapping conf="main" scope="runtime"/>
    </ivy:makepom>

Sorry, appreciated your answers though
NxyzzzzzZZZZzzzz

On Tue, Oct 16, 2012 at 3:16 PM, Matt Benson <gu...@gmail.com> wrote:

> I don't know why they're going to "optional" but why would you map
> "main" to two different maven scopes, and what would you have expected
> as a result?  AFAIK a given artifact/classifier combination can only
> be in one Maven scope.  Presumably you want "main" to map to
> "compile"...
>
> Matt
>
> On Tue, Oct 16, 2012 at 5:13 PM, Not Zippy <no...@gmail.com> wrote:
> > Originally I had tried this :
> >
> >      <mapping conf="main" scope="compile"/>
> >      <mapping conf="main" scope="runtime"/>
> >
> > and still the dependencies showed up as optional in the POM. Any other
> > thoughts ?
> >
> > thanks
> > Nz
> >
> >
> > On Tue, Oct 16, 2012 at 3:02 PM, Matt Benson <gu...@gmail.com>
> wrote:
> >>
> >> Yes, the conf attribute should not be a mapping; rather it should just
> >> be the name of one of your local configurations.
> >>
> >> Matt
> >>
> >> On Tue, Oct 16, 2012 at 4:49 PM, Not Zippy <no...@gmail.com> wrote:
> >> > I have set the mapping
> >> >
> >> >     <ivy:makepom ivyfile="${basedir}/ivy.xml"
> >> >                  conf="default"
> >> >                  pomfile="${build.dir}/${artifact.name}.pom">
> >> >      <mapping conf="main->default" scope="compile"/>
> >> >      <mapping conf="main->default" scope="runtime"/>
> >> >     </ivy:makepom>
> >> >
> >> > It still generates the POM with optional dependencies.
> >> >
> >> > thanks
> >> > Nz
> >> >
> >> >
> >> > On Tue, Oct 16, 2012 at 2:20 PM, Matt Benson <gu...@gmail.com>
> >> > wrote:
> >> >>
> >> >> You should be able to control this by using <mapping> elements nested
> >> >> into <makepom>.
> >> >>
> >> >> Matt
> >> >>
> >> >> On Tue, Oct 16, 2012 at 4:15 PM, Not Zippy <no...@gmail.com>
> wrote:
> >> >> > Hi
> >> >> >
> >> >> > For some reason I hadn't noticed till now that when I used ant +
> ivy
> >> >> > to
> >> >> > build my POMS that it created all the dependencies as "optional"
> >> >> > ie
> >> >> >     <dependency>
> >> >> >       <groupId>commons-io</groupId>
> >> >> >       <artifactId>commons-io</artifactId>
> >> >> >       <version>2.2</version>
> >> >> >       <optional>true</optional>
> >> >> >     </dependency>
> >> >> >
> >> >> > My ivy.xml looks like
> >> >> > <ivy-module version="1.0">
> >> >> >     <info
> >> >> >         organisation="xxx"
> >> >> >         module="ext-dx"
> >> >> >         status="integration"/>
> >> >> >     <configurations defaultconf="main">
> >> >> >       <conf name="core" visibility="private" />
> >> >> >       <conf name="common" extends="core" />
> >> >> >       <conf name="main" extends="core" />
> >> >> >       <conf name="default" extends="main" />
> >> >> >       <conf name="resource" extends="core" />
> >> >> >       <conf name="hidden" extends="core" />
> >> >> >       <conf name="test" extends="common" />
> >> >> >     </configurations>
> >> >> >     <publications>
> >> >> >       <artifact name="ext-dx" type="jar" conf="main"/>
> >> >> >       <artifact name="ext-dx" type="pom" conf="main"/>
> >> >> >       <artifact name="ext-dx-resource" type="zip" ext="zip"
> >> >> > conf="main"/>
> >> >> >       <artifact name="ext-dx-sources" type="source" ext="jar"
> >> >> > conf="main"/>
> >> >> >     </publications>
> >> >> >     <dependencies>
> >> >> >         <dependency conf="main->default" org="commons-io"
> >> >> > name="commons-io"
> >> >> > rev="2.2"/>
> >> >> > ....
> >> >> >
> >> >> > Make pom is
> >> >> >     <ivy:makepom ivyfile="${basedir}/ivy.xml"
> >> >> >                  conf="default"
> >> >> >                  pomfile="${build.dir}/${artifact.name}.pom">
> >> >> >      <mapping conf="default" scope="compile"/>
> >> >> >      <mapping conf="default" scope="runtime"/>
> >> >> >     </ivy:makepom>
> >> >> >
> >> >> > Anyone have idea why ? Can't see anything about it in the docs...
> >> >> >
> >> >> > THANKS
> >> >> > nZ
> >> >
> >> >
> >
> >
>

Re: Optional dependencies

Posted by Matt Benson <gu...@gmail.com>.
I don't know why they're going to "optional" but why would you map
"main" to two different maven scopes, and what would you have expected
as a result?  AFAIK a given artifact/classifier combination can only
be in one Maven scope.  Presumably you want "main" to map to
"compile"...

Matt

On Tue, Oct 16, 2012 at 5:13 PM, Not Zippy <no...@gmail.com> wrote:
> Originally I had tried this :
>
>      <mapping conf="main" scope="compile"/>
>      <mapping conf="main" scope="runtime"/>
>
> and still the dependencies showed up as optional in the POM. Any other
> thoughts ?
>
> thanks
> Nz
>
>
> On Tue, Oct 16, 2012 at 3:02 PM, Matt Benson <gu...@gmail.com> wrote:
>>
>> Yes, the conf attribute should not be a mapping; rather it should just
>> be the name of one of your local configurations.
>>
>> Matt
>>
>> On Tue, Oct 16, 2012 at 4:49 PM, Not Zippy <no...@gmail.com> wrote:
>> > I have set the mapping
>> >
>> >     <ivy:makepom ivyfile="${basedir}/ivy.xml"
>> >                  conf="default"
>> >                  pomfile="${build.dir}/${artifact.name}.pom">
>> >      <mapping conf="main->default" scope="compile"/>
>> >      <mapping conf="main->default" scope="runtime"/>
>> >     </ivy:makepom>
>> >
>> > It still generates the POM with optional dependencies.
>> >
>> > thanks
>> > Nz
>> >
>> >
>> > On Tue, Oct 16, 2012 at 2:20 PM, Matt Benson <gu...@gmail.com>
>> > wrote:
>> >>
>> >> You should be able to control this by using <mapping> elements nested
>> >> into <makepom>.
>> >>
>> >> Matt
>> >>
>> >> On Tue, Oct 16, 2012 at 4:15 PM, Not Zippy <no...@gmail.com> wrote:
>> >> > Hi
>> >> >
>> >> > For some reason I hadn't noticed till now that when I used ant + ivy
>> >> > to
>> >> > build my POMS that it created all the dependencies as "optional"
>> >> > ie
>> >> >     <dependency>
>> >> >       <groupId>commons-io</groupId>
>> >> >       <artifactId>commons-io</artifactId>
>> >> >       <version>2.2</version>
>> >> >       <optional>true</optional>
>> >> >     </dependency>
>> >> >
>> >> > My ivy.xml looks like
>> >> > <ivy-module version="1.0">
>> >> >     <info
>> >> >         organisation="xxx"
>> >> >         module="ext-dx"
>> >> >         status="integration"/>
>> >> >     <configurations defaultconf="main">
>> >> >       <conf name="core" visibility="private" />
>> >> >       <conf name="common" extends="core" />
>> >> >       <conf name="main" extends="core" />
>> >> >       <conf name="default" extends="main" />
>> >> >       <conf name="resource" extends="core" />
>> >> >       <conf name="hidden" extends="core" />
>> >> >       <conf name="test" extends="common" />
>> >> >     </configurations>
>> >> >     <publications>
>> >> >       <artifact name="ext-dx" type="jar" conf="main"/>
>> >> >       <artifact name="ext-dx" type="pom" conf="main"/>
>> >> >       <artifact name="ext-dx-resource" type="zip" ext="zip"
>> >> > conf="main"/>
>> >> >       <artifact name="ext-dx-sources" type="source" ext="jar"
>> >> > conf="main"/>
>> >> >     </publications>
>> >> >     <dependencies>
>> >> >         <dependency conf="main->default" org="commons-io"
>> >> > name="commons-io"
>> >> > rev="2.2"/>
>> >> > ....
>> >> >
>> >> > Make pom is
>> >> >     <ivy:makepom ivyfile="${basedir}/ivy.xml"
>> >> >                  conf="default"
>> >> >                  pomfile="${build.dir}/${artifact.name}.pom">
>> >> >      <mapping conf="default" scope="compile"/>
>> >> >      <mapping conf="default" scope="runtime"/>
>> >> >     </ivy:makepom>
>> >> >
>> >> > Anyone have idea why ? Can't see anything about it in the docs...
>> >> >
>> >> > THANKS
>> >> > nZ
>> >
>> >
>
>

Re: Optional dependencies

Posted by Not Zippy <no...@gmail.com>.
Originally I had tried this :

     <mapping conf="main" scope="compile"/>
     <mapping conf="main" scope="runtime"/>

and still the dependencies showed up as optional in the POM. Any other
thoughts ?

thanks
Nz

On Tue, Oct 16, 2012 at 3:02 PM, Matt Benson <gu...@gmail.com> wrote:

> Yes, the conf attribute should not be a mapping; rather it should just
> be the name of one of your local configurations.
>
> Matt
>
> On Tue, Oct 16, 2012 at 4:49 PM, Not Zippy <no...@gmail.com> wrote:
> > I have set the mapping
> >
> >     <ivy:makepom ivyfile="${basedir}/ivy.xml"
> >                  conf="default"
> >                  pomfile="${build.dir}/${artifact.name}.pom">
> >      <mapping conf="main->default" scope="compile"/>
> >      <mapping conf="main->default" scope="runtime"/>
> >     </ivy:makepom>
> >
> > It still generates the POM with optional dependencies.
> >
> > thanks
> > Nz
> >
> >
> > On Tue, Oct 16, 2012 at 2:20 PM, Matt Benson <gu...@gmail.com>
> wrote:
> >>
> >> You should be able to control this by using <mapping> elements nested
> >> into <makepom>.
> >>
> >> Matt
> >>
> >> On Tue, Oct 16, 2012 at 4:15 PM, Not Zippy <no...@gmail.com> wrote:
> >> > Hi
> >> >
> >> > For some reason I hadn't noticed till now that when I used ant + ivy
> to
> >> > build my POMS that it created all the dependencies as "optional"
> >> > ie
> >> >     <dependency>
> >> >       <groupId>commons-io</groupId>
> >> >       <artifactId>commons-io</artifactId>
> >> >       <version>2.2</version>
> >> >       <optional>true</optional>
> >> >     </dependency>
> >> >
> >> > My ivy.xml looks like
> >> > <ivy-module version="1.0">
> >> >     <info
> >> >         organisation="xxx"
> >> >         module="ext-dx"
> >> >         status="integration"/>
> >> >     <configurations defaultconf="main">
> >> >       <conf name="core" visibility="private" />
> >> >       <conf name="common" extends="core" />
> >> >       <conf name="main" extends="core" />
> >> >       <conf name="default" extends="main" />
> >> >       <conf name="resource" extends="core" />
> >> >       <conf name="hidden" extends="core" />
> >> >       <conf name="test" extends="common" />
> >> >     </configurations>
> >> >     <publications>
> >> >       <artifact name="ext-dx" type="jar" conf="main"/>
> >> >       <artifact name="ext-dx" type="pom" conf="main"/>
> >> >       <artifact name="ext-dx-resource" type="zip" ext="zip"
> >> > conf="main"/>
> >> >       <artifact name="ext-dx-sources" type="source" ext="jar"
> >> > conf="main"/>
> >> >     </publications>
> >> >     <dependencies>
> >> >         <dependency conf="main->default" org="commons-io"
> >> > name="commons-io"
> >> > rev="2.2"/>
> >> > ....
> >> >
> >> > Make pom is
> >> >     <ivy:makepom ivyfile="${basedir}/ivy.xml"
> >> >                  conf="default"
> >> >                  pomfile="${build.dir}/${artifact.name}.pom">
> >> >      <mapping conf="default" scope="compile"/>
> >> >      <mapping conf="default" scope="runtime"/>
> >> >     </ivy:makepom>
> >> >
> >> > Anyone have idea why ? Can't see anything about it in the docs...
> >> >
> >> > THANKS
> >> > nZ
> >
> >
>

Re: Optional dependencies

Posted by Matt Benson <gu...@gmail.com>.
Yes, the conf attribute should not be a mapping; rather it should just
be the name of one of your local configurations.

Matt

On Tue, Oct 16, 2012 at 4:49 PM, Not Zippy <no...@gmail.com> wrote:
> I have set the mapping
>
>     <ivy:makepom ivyfile="${basedir}/ivy.xml"
>                  conf="default"
>                  pomfile="${build.dir}/${artifact.name}.pom">
>      <mapping conf="main->default" scope="compile"/>
>      <mapping conf="main->default" scope="runtime"/>
>     </ivy:makepom>
>
> It still generates the POM with optional dependencies.
>
> thanks
> Nz
>
>
> On Tue, Oct 16, 2012 at 2:20 PM, Matt Benson <gu...@gmail.com> wrote:
>>
>> You should be able to control this by using <mapping> elements nested
>> into <makepom>.
>>
>> Matt
>>
>> On Tue, Oct 16, 2012 at 4:15 PM, Not Zippy <no...@gmail.com> wrote:
>> > Hi
>> >
>> > For some reason I hadn't noticed till now that when I used ant + ivy to
>> > build my POMS that it created all the dependencies as "optional"
>> > ie
>> >     <dependency>
>> >       <groupId>commons-io</groupId>
>> >       <artifactId>commons-io</artifactId>
>> >       <version>2.2</version>
>> >       <optional>true</optional>
>> >     </dependency>
>> >
>> > My ivy.xml looks like
>> > <ivy-module version="1.0">
>> >     <info
>> >         organisation="xxx"
>> >         module="ext-dx"
>> >         status="integration"/>
>> >     <configurations defaultconf="main">
>> >       <conf name="core" visibility="private" />
>> >       <conf name="common" extends="core" />
>> >       <conf name="main" extends="core" />
>> >       <conf name="default" extends="main" />
>> >       <conf name="resource" extends="core" />
>> >       <conf name="hidden" extends="core" />
>> >       <conf name="test" extends="common" />
>> >     </configurations>
>> >     <publications>
>> >       <artifact name="ext-dx" type="jar" conf="main"/>
>> >       <artifact name="ext-dx" type="pom" conf="main"/>
>> >       <artifact name="ext-dx-resource" type="zip" ext="zip"
>> > conf="main"/>
>> >       <artifact name="ext-dx-sources" type="source" ext="jar"
>> > conf="main"/>
>> >     </publications>
>> >     <dependencies>
>> >         <dependency conf="main->default" org="commons-io"
>> > name="commons-io"
>> > rev="2.2"/>
>> > ....
>> >
>> > Make pom is
>> >     <ivy:makepom ivyfile="${basedir}/ivy.xml"
>> >                  conf="default"
>> >                  pomfile="${build.dir}/${artifact.name}.pom">
>> >      <mapping conf="default" scope="compile"/>
>> >      <mapping conf="default" scope="runtime"/>
>> >     </ivy:makepom>
>> >
>> > Anyone have idea why ? Can't see anything about it in the docs...
>> >
>> > THANKS
>> > nZ
>
>

Re: Optional dependencies

Posted by Not Zippy <no...@gmail.com>.
I have set the mapping

    <ivy:makepom ivyfile="${basedir}/ivy.xml"
                 conf="default"
                 pomfile="${build.dir}/${artifact.name}.pom">
     <mapping conf="main->default" scope="compile"/>
     <mapping conf="main->default" scope="runtime"/>
    </ivy:makepom>

It still generates the POM with optional dependencies.

thanks
Nz

On Tue, Oct 16, 2012 at 2:20 PM, Matt Benson <gu...@gmail.com> wrote:

> You should be able to control this by using <mapping> elements nested
> into <makepom>.
>
> Matt
>
> On Tue, Oct 16, 2012 at 4:15 PM, Not Zippy <no...@gmail.com> wrote:
> > Hi
> >
> > For some reason I hadn't noticed till now that when I used ant + ivy to
> > build my POMS that it created all the dependencies as "optional"
> > ie
> >     <dependency>
> >       <groupId>commons-io</groupId>
> >       <artifactId>commons-io</artifactId>
> >       <version>2.2</version>
> >       <optional>true</optional>
> >     </dependency>
> >
> > My ivy.xml looks like
> > <ivy-module version="1.0">
> >     <info
> >         organisation="xxx"
> >         module="ext-dx"
> >         status="integration"/>
> >     <configurations defaultconf="main">
> >       <conf name="core" visibility="private" />
> >       <conf name="common" extends="core" />
> >       <conf name="main" extends="core" />
> >       <conf name="default" extends="main" />
> >       <conf name="resource" extends="core" />
> >       <conf name="hidden" extends="core" />
> >       <conf name="test" extends="common" />
> >     </configurations>
> >     <publications>
> >       <artifact name="ext-dx" type="jar" conf="main"/>
> >       <artifact name="ext-dx" type="pom" conf="main"/>
> >       <artifact name="ext-dx-resource" type="zip" ext="zip" conf="main"/>
> >       <artifact name="ext-dx-sources" type="source" ext="jar"
> conf="main"/>
> >     </publications>
> >     <dependencies>
> >         <dependency conf="main->default" org="commons-io"
> name="commons-io"
> > rev="2.2"/>
> > ....
> >
> > Make pom is
> >     <ivy:makepom ivyfile="${basedir}/ivy.xml"
> >                  conf="default"
> >                  pomfile="${build.dir}/${artifact.name}.pom">
> >      <mapping conf="default" scope="compile"/>
> >      <mapping conf="default" scope="runtime"/>
> >     </ivy:makepom>
> >
> > Anyone have idea why ? Can't see anything about it in the docs...
> >
> > THANKS
> > nZ
>

Re: Optional dependencies

Posted by Matt Benson <gu...@gmail.com>.
You should be able to control this by using <mapping> elements nested
into <makepom>.

Matt

On Tue, Oct 16, 2012 at 4:15 PM, Not Zippy <no...@gmail.com> wrote:
> Hi
>
> For some reason I hadn't noticed till now that when I used ant + ivy to
> build my POMS that it created all the dependencies as "optional"
> ie
>     <dependency>
>       <groupId>commons-io</groupId>
>       <artifactId>commons-io</artifactId>
>       <version>2.2</version>
>       <optional>true</optional>
>     </dependency>
>
> My ivy.xml looks like
> <ivy-module version="1.0">
>     <info
>         organisation="xxx"
>         module="ext-dx"
>         status="integration"/>
>     <configurations defaultconf="main">
>       <conf name="core" visibility="private" />
>       <conf name="common" extends="core" />
>       <conf name="main" extends="core" />
>       <conf name="default" extends="main" />
>       <conf name="resource" extends="core" />
>       <conf name="hidden" extends="core" />
>       <conf name="test" extends="common" />
>     </configurations>
>     <publications>
>       <artifact name="ext-dx" type="jar" conf="main"/>
>       <artifact name="ext-dx" type="pom" conf="main"/>
>       <artifact name="ext-dx-resource" type="zip" ext="zip" conf="main"/>
>       <artifact name="ext-dx-sources" type="source" ext="jar" conf="main"/>
>     </publications>
>     <dependencies>
>         <dependency conf="main->default" org="commons-io" name="commons-io"
> rev="2.2"/>
> ....
>
> Make pom is
>     <ivy:makepom ivyfile="${basedir}/ivy.xml"
>                  conf="default"
>                  pomfile="${build.dir}/${artifact.name}.pom">
>      <mapping conf="default" scope="compile"/>
>      <mapping conf="default" scope="runtime"/>
>     </ivy:makepom>
>
> Anyone have idea why ? Can't see anything about it in the docs...
>
> THANKS
> nZ