Context Creation for Deploying SciJava Apps without Eclipse

16 views
Skip to first unread message

Paul Dumais

unread,
Apr 8, 2014, 2:20:19 PM4/8/14
to sci...@googlegroups.com
I've been having a really hard time getting creating a Context object in my app. I'm not using eclispe. I'm using clojure. During development, things work fine because I can create my Context object at run-time as the jvm has access to my maven artifacts in my home/.m2 directory. However, when I deploy my app, all the dependencies are put into an 'uberjar'. But then when the Context constructor looks for the required plugins (SCIFIOPulgins) it can't find them.

Is the Context object meant to be created at run time? I can create it at compile time, but Clojure does not provide easy ways to do this at compile time only (nearly impossible - I've search and tried alot). I just want to make sure I'm doing things correctly so I can concentrate my efforts in the correct direction.

If I manage to create the Context object (or ImgOpener) at compile time, will I run into problems later at run time when these classes are in the uberjar? If I'm meant to create the Context at run time, how do I package my classes in the uberjar so that they can be found when the Context object is being created?

Curtis Rueden

unread,
Apr 8, 2014, 3:49:28 PM4/8/14
to Paul Dumais, SciJava
Hi Paul,

> However, when I deploy my app, all the dependencies are put into an
> 'uberjar'. But then when the Context constructor looks for the
> required plugins (SCIFIOPulgins) it can't find them.

Certainly that is not supposed to be the case. It is supposed to be possible to spin up a SciJava context even if its plugins reside in an uber-JAR. However, the mechanics and feasibility of that will depend on the structure of the uber-JAR. Is it a "jars-in-a-jar" uber-JAR? Or just a bunch of classes lumped together? Is it shaded? etc.

Can you post a minimal example somewhere (e.g., on GitHub) that demonstrates the problem? It would be much easier to troubleshoot from there.

> Is the Context object meant to be created at run time? I can create it
> at compile time

I think there is a problem with the terminology here. There is no such thing as "creating an object at compile time." Runtime is when code executes, which includes creation of objects.

> how do I package my classes in the uberjar so that they can be found
> when the Context object is being created?

The goal is indeed for the classes and resources to be loadable from your uber-JAR, including discovery of the SciJava plugin annotations. If you can share a non-working test case, we can isolate the bug and fix the problem in SciJava Common.

Regards,
Curtis


--
You received this message because you are subscribed to the Google Groups "scijava" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scijava+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paul Dumais

unread,
Apr 8, 2014, 4:47:39 PM4/8/14
to Curtis Rueden, SciJava
Ah, thanks for the quick reply. My response is in the new github issue:
https://github.com/scijava/scijava-common/issues/37

Cheers
Reply all
Reply to author
Forward
0 new messages