Eclipse Maven workflow: depencies copied to Fiji.app directory

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

Eclipse Maven workflow: depencies copied to Fiji.app directory

Davíð Þór Bragason
Hello,

I'm trying to figure out the best workflow for ImageJ1 plugin development
using Eclipse and the m2e plugin. I'm new to all the involved components.

Manually copying the resulting jar file into Fiji.app/plugins directory
works fine. I do not copy the Maven depency jars, as they are already
included in Fiji, albeit not exactly the same versions.

But if I define the imagej.app.directory property in the project pom.xml to
enable the imagej-maven-plugin and execute "Maven build" or "Maven install"
from Eclipse, then all the dependencies are copied as well, resulting in
the following warnings:

[INFO] Copying ij-1.48h.jar to C:\Users\david\Desktop\Fiji.app\jars
[WARNING] Possibly incompatible version exists: ij-1.48i.jar
[INFO] Copying jfreechart-1.0.13.jar to C:\Users\david\Desktop\Fiji.app\jars
[WARNING] Possibly incompatible version exists: jfreechart-1.0.14.jar
[INFO] Copying jcommon-1.0.16.jar to C:\Users\david\Desktop\Fiji.app\jars
[WARNING] Possibly incompatible version exists: jcommon-1.0.17.jar

I'm using the latest pom-scijava, as of today:

<parent>
<groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId>
<version>1.106</version>
</parent>

So, my questions:
1. I  can imagine the plugins directory getting filled with multiple
versions of the jars over time if I do it this way. Is there a way to avoid
the copying of dependencies, other than doing it manually?

2. Is there any way to automatically use the latest pom-scijava?

Thanks,
David

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

Re: Eclipse Maven workflow: depencies copied to Fiji.app directory

Jirka
This post was updated on .
Hello,
you can check our project https://github.com/Borda/ij-CMP-BIA while I am
quite new in this development too I tried to make as many comments as I
can... Well after all if you set <imagej.app.directory>
/.../Applications/Fiji.app</imagej.app.directory>  in the pom.xml and later
on you just call "mvn install" you have done everything (compile, run
tests, and install your package into ImageJ/Fiji instance) done.

Jirka


On 4 December 2013 13:06, Davíð Þór Bragason <dbragason@gmail.com> wrote:

> Hello,
>
> I'm trying to figure out the best workflow for ImageJ1 plugin development
> using Eclipse and the m2e plugin. I'm new to all the involved components.
>
> Manually copying the resulting jar file into Fiji.app/plugins directory
> works fine. I do not copy the Maven depency jars, as they are already
> included in Fiji, albeit not exactly the same versions.
>
> But if I define the imagej.app.directory property in the project pom.xml to
> enable the imagej-maven-plugin and execute "Maven build" or "Maven install"
> from Eclipse, then all the dependencies are copied as well, resulting in
> the following warnings:
>
> [INFO] Copying ij-1.48h.jar to C:\Users\david\Desktop\Fiji.app\jars
> [WARNING] Possibly incompatible version exists: ij-1.48i.jar
> [INFO] Copying jfreechart-1.0.13.jar to
> C:\Users\david\Desktop\Fiji.app\jars
> [WARNING] Possibly incompatible version exists: jfreechart-1.0.14.jar
> [INFO] Copying jcommon-1.0.16.jar to C:\Users\david\Desktop\Fiji.app\jars
> [WARNING] Possibly incompatible version exists: jcommon-1.0.17.jar
>
> I'm using the latest pom-scijava, as of today:
>
> <parent>
> <groupId>org.scijava</groupId>
> <artifactId>pom-scijava</artifactId>
> <version>1.106</version>
> </parent>
>
> So, my questions:
> 1. I  can imagine the plugins directory getting filled with multiple
> versions of the jars over time if I do it this way. Is there a way to avoid
> the copying of dependencies, other than doing it manually?
>
> 2. Is there any way to automatically use the latest pom-scijava?
>
> Thanks,
> David
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--
Best regards and wishes of a nice day, Jiří Borovec
----------------------------------------------------------------------------------------------------
Jiří Borovec <jiri.borovec@fel.cvut.cz>
PhD student at CMP CTU, ISC member
http://cmp.felk.cvut.cz/~borovji3

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

Re: Eclipse Maven workflow: depencies copied to Fiji.app directory

ctrueden
In reply to this post by Davíð Þór Bragason
Hi David,

> 1. I  can imagine the plugins directory getting filled with multiple
> versions of the jars over time if I do it this way. Is there a way to
> avoid the copying of dependencies, other than doing it manually?

It sounds like copying the JAR manually is your best bet. Or you could
write a simple .bat file to build the code, copy in the artifact and launch
ImageJ1.

The goal is really to streamline the Edit, Compile, Run/Debug cycle. To
that end, I suggest adding a main method to your plugin:

public static void main(String[] args) {
  new ij.ImageJ();
  IJ.runPlugIn(MyClass.class.getName(), "");
}

Where "MyClass" is the name of your plugin class.

That way, you can just launch your plugin from Eclipse to quickly test.

The only faster way I know of is to develop your plugin in the Fiji Script
Editor, since you can execute the edited code without needing to restart
ImageJ. But then you lose much of the power of the Eclipse IDE.

> 2. Is there any way to automatically use the latest pom-scijava?

Nope. And I would avoid doing that, even if you could.

Maven once had such a feature (setting the version to "LATEST") but it
caused all sorts of problems. Imagine if you had a dependency which itself
depended on the latest version of something else. Your build would no
longer be reproducible -- that upstream library could release a new
incompatible version which breaks your build, or worse, subtly introduces
errors into your runtime behavior. It is much safer to pin to specific
release versions of everything.

There is such a thing as a "version range" in a Maven dependency, but they
are not supported for parents [1].

If your goal is to use "the latest version of ImageJ1" you can use a
version range for that; e.g.:

<properties>
  <imagej1.version>[1.45s,)</imagej1.version>
</properties>

Old versions of pom-scijava actually declared the ImageJ1 version that way
(to always use the latest), but again, it ran into problems of an
irreproducible build. Wayne would release a new version of ImageJ1 and
suddenly code that used to build wouldn't compile anymore. So I would still
suggest pinning to a fixed version of ImageJ1 when you can.

Regards,
Curtis

[1] https://jira.codehaus.org/browse/MNG-2199


On Wed, Dec 4, 2013 at 6:06 AM, Davíð Þór Bragason <[hidden email]>wrote:

> Hello,
>
> I'm trying to figure out the best workflow for ImageJ1 plugin development
> using Eclipse and the m2e plugin. I'm new to all the involved components.
>
> Manually copying the resulting jar file into Fiji.app/plugins directory
> works fine. I do not copy the Maven depency jars, as they are already
> included in Fiji, albeit not exactly the same versions.
>
> But if I define the imagej.app.directory property in the project pom.xml to
> enable the imagej-maven-plugin and execute "Maven build" or "Maven install"
> from Eclipse, then all the dependencies are copied as well, resulting in
> the following warnings:
>
> [INFO] Copying ij-1.48h.jar to C:\Users\david\Desktop\Fiji.app\jars
> [WARNING] Possibly incompatible version exists: ij-1.48i.jar
> [INFO] Copying jfreechart-1.0.13.jar to
> C:\Users\david\Desktop\Fiji.app\jars
> [WARNING] Possibly incompatible version exists: jfreechart-1.0.14.jar
> [INFO] Copying jcommon-1.0.16.jar to C:\Users\david\Desktop\Fiji.app\jars
> [WARNING] Possibly incompatible version exists: jcommon-1.0.17.jar
>
> I'm using the latest pom-scijava, as of today:
>
> <parent>
> <groupId>org.scijava</groupId>
> <artifactId>pom-scijava</artifactId>
> <version>1.106</version>
> </parent>
>
> So, my questions:
> 1. I  can imagine the plugins directory getting filled with multiple
> versions of the jars over time if I do it this way. Is there a way to avoid
> the copying of dependencies, other than doing it manually?
>
> 2. Is there any way to automatically use the latest pom-scijava?
>
> Thanks,
> David
>
> --
> 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
|

Re: Eclipse Maven workflow: depencies copied to Fiji.app directory

dscho
Hi,

On Mon, 13 Jan 2014, Curtis Rueden wrote:

> Hi David,
>
> > 1. I  can imagine the plugins directory getting filled with multiple
> > versions of the jars over time if I do it this way. Is there a way to
> > avoid the copying of dependencies, other than doing it manually?
>
> It sounds like copying the JAR manually is your best bet.

Note that you can use the imagej-maven-plugin for that: if you run Maven
manually in your project's top-level directory, you can do this:

        mvn -Dimagej.app.directory=/path/to/my/Fiji.app/ install

(This assumes that you have a Fiji installed and that you substitute the
/path/to/my/Fiji.app/ with whatever is appropriate in your setup).

Since you use pom-scijava as a parent, that should result in the
imagej-maven-plugin picking up the property and copying your .jar file
(along with all the dependencies required by your plugin) into the
Fiji.app/ directory structure.

Ciao,
Johannes

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

Re: Eclipse Maven workflow: depencies copied to Fiji.app directory

ctrueden
Hi David,

> Note that you can use the imagej-maven-plugin for that: if you run
> Maven manually in your project's top-level directory, you can do this:
>
>         mvn -Dimagej.app.directory=/path/to/my/Fiji.app/ install

Johannes and I investigated further, and realized there is one other
property you must set to delete the old versions when doing the copy:

    mvn -Dimagej.app.directory=/path/to/my/Fiji.app/
-Ddelete.other.versions=true install

On in the POM you can set:

<properties>
  <delete.other.versions>true</delete.other.versions>
</properties>

This is implemented, but not well tested. Give it a shot, and let us know
if you have any problems with it. Also be warned that this behavior may
need to change in the future. (Note that imagej-maven-plugin is currently
versioned at 0.x, which according to SemVer [1] means anything can change
at any time.)

HTH,
Curtis

[1] http://semver.org/


On Mon, Jan 13, 2014 at 1:14 PM, Johannes Schindelin <
[hidden email]> wrote:

> Hi,
>
> On Mon, 13 Jan 2014, Curtis Rueden wrote:
>
> > Hi David,
> >
> > > 1. I  can imagine the plugins directory getting filled with multiple
> > > versions of the jars over time if I do it this way. Is there a way to
> > > avoid the copying of dependencies, other than doing it manually?
> >
> > It sounds like copying the JAR manually is your best bet.
>
> Note that you can use the imagej-maven-plugin for that: if you run Maven
> manually in your project's top-level directory, you can do this:
>
>         mvn -Dimagej.app.directory=/path/to/my/Fiji.app/ install
>
> (This assumes that you have a Fiji installed and that you substitute the
> /path/to/my/Fiji.app/ with whatever is appropriate in your setup).
>
> Since you use pom-scijava as a parent, that should result in the
> imagej-maven-plugin picking up the property and copying your .jar file
> (along with all the dependencies required by your plugin) into the
> Fiji.app/ directory structure.
>
> Ciao,
> Johannes
>

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