Posted by
ctrueden on
Dec 03, 2015; 5:28pm
URL: http://imagej.273.s1.nabble.com/Eclipse-woes-tp5015004p5015122.html
Hi everyone,
All of these approaches are fine... until you want to share your code with
others.
Using Maven avoids IDE lock-in. Others can use whichever tool they prefer
to easily build, develop and run your code. It is super easy to import a
Maven project into your IDE and just go—or to build it from the command
line with one simple command.
With the non-Maven approaches, you have to, at minimum, commit your Eclipse
metadata files (.classpath, .project, .settings) and also commit all your
dependencies (JAR files your plugin uses). Or else require your
collaborators to manually download and link in those same dependencies to
Eclipse.
If you are serious about creating something reusable by others, onto which
the community can build and contribute further, I would strongly suggest
using a project management system such as Maven or Gradle.
Regards,
Curtis
P.S. See also
http://imagej.net/DistributionOn Thu, Dec 3, 2015 at 4:04 AM, Peterbauer Thomas <
[hidden email]> wrote:
> On 2015-12-03 09:06, Dimiter Prodanov wrote:
> > Hi Gabriel,
> >
> > I basically use the same strategy as Wilhelm.
> > I typically code a main method so that I could start ImageJ from Eclipse
> by
> > defining a launcher
> >
> > public static void main(String[] args) {
> > try {
> > File f=new File(args[0]);
> > if (f.exists() && f.isDirectory() ) {
> > System.setProperty("plugins.dir", args[0]);
> > new ImageJ();
> > } else {
> > throw new IllegalArgumentException();
> > }
> > }
> > catch (Exception ex) {
> > IJ.log("plugins.dir misspecified\n");
> > ex.printStackTrace();
> > }
> > }
>
> Another very convenient way to launch ImageJ from within Eclipse for
> simple projects without Maven is to define ImageJ either as an external
> JAR or user library:
>
> Project > Properties > Java Build Path > choose the Libraries tab > Add
> External JARs...
>
> and specify the path to ij.jar (you may use your normal ImageJ path).
> You can even define ImageJ as User Library (Add Library...) and/or
> attach source/javadocs to the external JAR/library.
>
> Then, make a run configuration:
>
> Project > Properties > Run/Debug Settings > New... (click Java Application)
>
> In the "Main" tab of the dialog popping up, clicck "Search" to find the
> main class of the ij.jar defined as external JAR/library. Eclipse will
> find ij.ImageJ.
>
> In the "Arguments" tab, pass the ImageJ "-run" command to launch your
> plugin:
>
> -run "NameOfMyPlugin"
>
> You can give more arguments (-ijpath to specify the plugin directory,
> -macro to run a macro to load a sample image before calling your plugin
> etc.). Exceptions and System.out messages are redirected to the console
> in Eclipse.
>
> Best,
> Thomas
>
>
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html