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 Benjamin Damm <bd...@silverspringnet.com> on 2008/09/23 19:38:41 UTC

Depending on bouncycastle

Hi ivy users,

  I've started to integrate ivy with our build process, and it is fantastic.  
There's something I'm having trouble with, though, and that's understanding 
how to depend on bouncycastle.  It comes in at least two flavors; one for 
jdk15 and one for jdk16.  We have developers on both and previously had our 
build scripts pick the right one depending on what version of java ant was 
run under.

How to do this with ivy?  Ivy doesn't appear to have any conditional 
dependency abilities, so I can't choose one artifact or another based on what 
version of java I'm running.  I suppose I could generate an 
ivy.xml "just-in-time" but I'd prefer not to.  Anyone surpassed this little 
hurdle?

Thank you,
-Ben

-- 
Benjamin Damm
Silver Spring Networks
650-298-4200 x201

Re: Depending on bouncycastle

Posted by Benjamin Damm <bd...@silverspringnet.com>.
Correction.. it does work.  I just had to clean out the project's local cache 
of old copies.  Thanks!

-Ben

On Tuesday 23 September 2008 03:20:52 pm Benjamin Damm wrote:
> Your suggestion got me started, but I veered off into linking the ant
> properties to the file names.  That got me thinking; why do I even need the
> classifier?  Can't this just be done with properties alone?  So here's what
> I ended up with:
>
> ${repository.dir}/bouncycastle/140/ivy.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <ivy-module version="2.0">
>     <info organisation="bouncycastle" module="bouncycastle" revision="140"
> /> <publications>
>         <artifact name="bcprov-${base.jdk.version}" type="jar" ext="jar"
> conf="default"/> </publications>
> </ivy-module>
>
> ${ivysettings.dir}/ivysettings.xml:
> ...
>         <filesystem name="ivycontrib">
>             <artifact
> pattern="${ivycontrib.dir}/[module]/[revision]/[artifact]-[revision].[ext]"
> /> <artifact
> pattern="${ivycontrib.dir}/[module]/[revision]/[artifact]-${base.jdk.versio
>n}-[revision].[ext]" /> <ivy
> pattern="${ivycontrib.dir}/[module]/[revision]/ivy.xml" /> </filesystem>
> ...
>
> Which actually sort of works... except that both jars end up in the
> classpath.  This is strange.  So my classpath ends up looking like:
> ...:${ivy.cache.dir}/bouncycastle/bouncycastle/jars/bcprov-jdk15-140.jar:${
>ivy.cache.dir}bouncycastle/bouncycastle/jars/bcprov-jdk16-140.jar:...
>
> Creating a different module doesn't quite solve the problem, because
> somehow I have to still select the right one.  Unless, I suppose, I could
> put a variable such as ${ivy.jdk.version} into my project's ivy.xml.
>
> -Ben
>
> On Tuesday 23 September 2008 02:15:50 pm Jim White wrote:
> > I think it is best to think of those as two different modules (because,
> > after all, they are).
> >
> > Maven added the "classifier" field to deal with that (the issue being
> > that folks don't want to use different module names for JDK version
> > dependency) and Ivy supports that now too.
> >
> > http://www.nabble.com/Re%3A-Classifier-frustration-p16740537.html
> >
> > https://issues.apache.org/jira/browse/IVY-803
> >
> > You can define an Ant property in your build to supply the right "jdk15"
> > or "jdk16" value for the classifier.
> >
> > Jim
> >
> > Benjamin Damm wrote:
> > > Hi ivy users,
> > >
> > >   I've started to integrate ivy with our build process, and it is
> > > fantastic. There's something I'm having trouble with, though, and
> > > that's understanding how to depend on bouncycastle.  It comes in at
> > > least two flavors; one for jdk15 and one for jdk16.  We have developers
> > > on both and previously had our build scripts pick the right one
> > > depending on what version of java ant was run under.
> > >
> > > How to do this with ivy?  Ivy doesn't appear to have any conditional
> > > dependency abilities, so I can't choose one artifact or another based
> > > on what version of java I'm running.  I suppose I could generate an
> > > ivy.xml "just-in-time" but I'd prefer not to.  Anyone surpassed this
> > > little hurdle?
> > >
> > > Thank you,
> > > -Ben



-- 
Benjamin Damm
Silver Spring Networks
650-298-4200 x201

Re: Depending on bouncycastle

Posted by Benjamin Damm <bd...@silverspringnet.com>.
Your suggestion got me started, but I veered off into linking the ant properties to the file names.  That got me thinking; why do I even need the 
classifier?  Can't this just be done with properties alone?  So here's what I ended up with:

${repository.dir}/bouncycastle/140/ivy.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0">
    <info organisation="bouncycastle" module="bouncycastle" revision="140" />
    <publications>
        <artifact name="bcprov-${base.jdk.version}" type="jar" ext="jar" conf="default"/>
    </publications>
</ivy-module>

${ivysettings.dir}/ivysettings.xml:
...
        <filesystem name="ivycontrib">
            <artifact pattern="${ivycontrib.dir}/[module]/[revision]/[artifact]-[revision].[ext]" />
            <artifact pattern="${ivycontrib.dir}/[module]/[revision]/[artifact]-${base.jdk.version}-[revision].[ext]" />
            <ivy pattern="${ivycontrib.dir}/[module]/[revision]/ivy.xml" />
        </filesystem>
...

Which actually sort of works... except that both jars end up in the classpath.  This is strange.  So my classpath ends up looking like:
...:${ivy.cache.dir}/bouncycastle/bouncycastle/jars/bcprov-jdk15-140.jar:${ivy.cache.dir}bouncycastle/bouncycastle/jars/bcprov-jdk16-140.jar:...

Creating a different module doesn't quite solve the problem, because somehow I have to still select the right one.  Unless, I suppose, I could put a 
variable such as ${ivy.jdk.version} into my project's ivy.xml.

-Ben



On Tuesday 23 September 2008 02:15:50 pm Jim White wrote:
> I think it is best to think of those as two different modules (because,
> after all, they are).
>
> Maven added the "classifier" field to deal with that (the issue being
> that folks don't want to use different module names for JDK version
> dependency) and Ivy supports that now too.
>
> http://www.nabble.com/Re%3A-Classifier-frustration-p16740537.html
>
> https://issues.apache.org/jira/browse/IVY-803
>
> You can define an Ant property in your build to supply the right "jdk15"
> or "jdk16" value for the classifier.
>
> Jim
>
> Benjamin Damm wrote:
> > Hi ivy users,
> >
> >   I've started to integrate ivy with our build process, and it is
> > fantastic. There's something I'm having trouble with, though, and that's
> > understanding how to depend on bouncycastle.  It comes in at least two
> > flavors; one for jdk15 and one for jdk16.  We have developers on both and
> > previously had our build scripts pick the right one depending on what
> > version of java ant was run under.
> >
> > How to do this with ivy?  Ivy doesn't appear to have any conditional
> > dependency abilities, so I can't choose one artifact or another based on
> > what version of java I'm running.  I suppose I could generate an
> > ivy.xml "just-in-time" but I'd prefer not to.  Anyone surpassed this
> > little hurdle?
> >
> > Thank you,
> > -Ben



-- 
Benjamin Damm
Silver Spring Networks
650-298-4200 x201

Re: Depending on bouncycastle

Posted by Jim White <ji...@pagesmiths.com>.
I think it is best to think of those as two different modules (because, 
after all, they are).

Maven added the "classifier" field to deal with that (the issue being 
that folks don't want to use different module names for JDK version 
dependency) and Ivy supports that now too.

http://www.nabble.com/Re%3A-Classifier-frustration-p16740537.html

https://issues.apache.org/jira/browse/IVY-803

You can define an Ant property in your build to supply the right "jdk15" 
or "jdk16" value for the classifier.

Jim

Benjamin Damm wrote:

> Hi ivy users,
> 
>   I've started to integrate ivy with our build process, and it is fantastic.  
> There's something I'm having trouble with, though, and that's understanding 
> how to depend on bouncycastle.  It comes in at least two flavors; one for 
> jdk15 and one for jdk16.  We have developers on both and previously had our 
> build scripts pick the right one depending on what version of java ant was 
> run under.
> 
> How to do this with ivy?  Ivy doesn't appear to have any conditional 
> dependency abilities, so I can't choose one artifact or another based on what 
> version of java I'm running.  I suppose I could generate an 
> ivy.xml "just-in-time" but I'd prefer not to.  Anyone surpassed this little 
> hurdle?
> 
> Thank you,
> -Ben
>