How to handle dependencies

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to handle dependencies

Heerpa
Hi everyone,

 

some time ago, I wrote a plugin that uses the apache commons-math 2.2. I am
now trying to update to 3 as I think that is what Fiji incorporates in the
jars folder. However, when I copy the commons-math.jar from the jars folder
into where I compile my code, it does not work. So I downloaded the
commons-math 3.2 from apache and used that. Now I do not know whether I
should copy the downloaded jars to the fiji jars folder - I feel it is not
the best approach.

Also, is there a way to determine what exactly is the version Fiji updates
to? In general, how should I best manage dependencies?

 

Thanks

   Heinrich


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to handle dependencies

dscho
Hi Heinrich,

On Tue, 14 May 2013, Heinrich Grabmayr wrote:

> some time ago, I wrote a plugin that uses the apache commons-math 2.2. I
> am now trying to update to 3 as I think that is what Fiji incorporates
> in the jars folder.

Indeed, we require commons-math 3 for some time now.

> However, when I copy the commons-math.jar from the jars folder into
> where I compile my code, it does not work.

You mean you get a compile error?

> So I downloaded the commons-math 3.2 from apache and used that. Now I do
> not know whether I should copy the downloaded jars to the fiji jars
> folder - I feel it is not the best approach.

I *think* that we are still using a 3.0-SNAPSHOT or some such. Probably
the best idea would be to update that library in Fiji itself.

> Also, is there a way to determine what exactly is the version Fiji updates
> to? In general, how should I best manage dependencies?

There are a couple of left-over files from the time when Fiji's updater
stripped all version numbers. Unfortunately, commons-math.jar is one of
them. Looking inside (a .jar is just a .zip file with a convention where
which files go), the META-INF/MANIFEST.MF suggests that it is indeed a
3.0-SNAPSHOT version.

Next time that file gets uploaded, it will be with the new updater,
though, so it will have the correct version encoded in the file name.

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to handle dependencies

ctrueden
In reply to this post by Heerpa
Hi Heinrich,

> In general, how should I best manage dependencies?

One thing Johannes didn't mention: Fiji uses Maven for dependency
management. See this page for details:
    http://fiji.sc/Maven

If you set up your project with Maven, you can be sure your dependency
release versions match those of Fiji. (For "SNAPSHOT" versions it is a bit
more tricky and complicated; feel free to follow up with more questions if
needed.)

Regards,
Curtis


On Tue, May 14, 2013 at 5:55 AM, Heinrich Grabmayr
<[hidden email]>wrote:

> Hi everyone,
>
>
>
> some time ago, I wrote a plugin that uses the apache commons-math 2.2. I am
> now trying to update to 3 as I think that is what Fiji incorporates in the
> jars folder. However, when I copy the commons-math.jar from the jars folder
> into where I compile my code, it does not work. So I downloaded the
> commons-math 3.2 from apache and used that. Now I do not know whether I
> should copy the downloaded jars to the fiji jars folder - I feel it is not
> the best approach.
>
> Also, is there a way to determine what exactly is the version Fiji updates
> to? In general, how should I best manage dependencies?
>
>
>
> Thanks
>
>    Heinrich
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

AW: How to handle dependencies

Heerpa
In reply to this post by dscho
Curtis, thanks for the hint about maven. Right now I do not use a
development environment but compile using apache ant in the command line. My
project isn't that big actually. So I think that maven is a bit of an
overkill for me right now.


Hi Johannes,

> Gesendet: Dienstag, 14. Mai 2013 20:33
>
> > some time ago, I wrote a plugin that uses the apache commons-math 2.2.
> > I am now trying to update to 3 as I think that is what Fiji
> > incorporates in the jars folder.
>
> Indeed, we require commons-math 3 for some time now.
>
> > However, when I copy the commons-math.jar from the jars folder into
> > where I compile my code, it does not work.
>
> You mean you get a compile error?

Yes indeed. The compiler tells me that the packages
(org.apache.commons.math3.somepackage e.g. exception) do not exist.

>
> > So I downloaded the commons-math 3.2 from apache and used that. Now I
> > do not know whether I should copy the downloaded jars to the fiji jars
> > folder - I feel it is not the best approach.
>
> I *think* that we are still using a 3.0-SNAPSHOT or some such. Probably
the
> best idea would be to update that library in Fiji itself.
>
> > Also, is there a way to determine what exactly is the version Fiji
> > updates to? In general, how should I best manage dependencies?
>
> There are a couple of left-over files from the time when Fiji's updater
> stripped all version numbers. Unfortunately, commons-math.jar is one of
> them. Looking inside (a .jar is just a .zip file with a convention where
which
> files go), the META-INF/MANIFEST.MF suggests that it is indeed a 3.0-
> SNAPSHOT version.

I had a look into my fiji-updated version and ist manifest.mf also stated
that it was a 3.0 version.
Then I had a look at the .class es, and compared it to what packages the
javadocs include (http://commons.apache.org/proper/commons-math/)
It seems very much that it is actually a commons-math 2.2, only stating in
the manifest that it was a 3.0. All of the packages present can be found in
the javadoc of 2.2, but not all of the packages in the javadoc can be found.
3.x has a different naming convention. (x.commons.math3.y instead of
x.commons.math.y, for one)

- Is it normal that not all of the functionality is present in the version
in fiji? What should I do if I was to use that additional functionality? an
example would be commons.math.estimation.
- Is there really an inconsistency in verisoning, or have I been confused by
something?

>
> Next time that file gets uploaded, it will be with the new updater,
though,
> so it will have the correct version encoded in the file name.
>
> Ciao,
> Johannes

Cheers
    Heinrich

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: AW: How to handle dependencies

dscho
Hi Heinrich,

On Tue, 21 May 2013, Heinrich Grabmayr wrote:

> Curtis, thanks for the hint about maven. Right now I do not use a
> development environment but compile using apache ant in the command
> line. My project isn't that big actually. So I think that maven is a bit
> of an overkill for me right now.

Funny that you should say that... whenever I look at build.xml files and
compare them with pom.xml files such as

        https://github.com/imagej/minimal-ij1-plugin/blob/master/pom.xml

I find the latter dramatically simpler and more organized. *And* it solves
the dependency problem (the vast majority of Ant-based projects I saw
ship binaries of their dependencies together with the source code).

So personally, I use Maven also for small projects...

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html