Skip to content

Implement Grab resolver ? #3

Open

Description

@hadim

The ScriptEngine does not seem to handle Groovy @ annotations such as @GrabResolver and @Grab : http://docs.groovy-lang.org/latest/html/documentation/grape.html

I don't understand at what level this should be implemented. I have the feeling that the current implementation at https://github.com/scijava/scripting-groovy/blob/master/src/main/java/org/scijava/plugins/scripting/groovy/GroovyScriptEngine.java#L197 is not good enough.

We should try to do something similar as Beaker : https://github.com/twosigma/beakerx/blob/6a23a9d58f31af0518c31d266ee327ab8ff20b87/kernel/groovy/src/main/java/com/twosigma/beaker/groovy/evaluator/GroovyEvaluator.java

Can someone confirm ?

Activity

  1. hadim commented on Apr 17, 2017

    @hadim
    ContributorAuthor

    See here to potentially fix this issue : twosigma/beakerx#3650

  2. ctrueden commented on Nov 1, 2019

    @ctrueden
    Member

    It works in my tests. For example, the following script:

    @Grab ('org.knowm.xchart:xchart:3.5.4')
    import org.knowm.xchart.XChartPanel
    println(XChartPanel.class)

    prints:

    class org.knowm.xchart.XChartPanel
    

    However, it also emits to the console:

    [WARNING] Ignoring invalid parameter: Grab ('org.knowm.xchart:xchart:3.5.4')
    

    Because the SciJava script framework aggressively treats things like @Grab as SciJava parameters. This is a more general annoyance that should be fixed.

    As a workaround, with scijava-grab installed, one can instead write:

    #@dependency(group='org.knowm.xchart', artifact='xchart', version='3.5.4')
    import org.knowm.xchart.XChartPanel
    println(XChartPanel.class)

    But then the console instead emits:

    Resolving dependency: org.knowm.xchart#xchart;3.5.4 {default=[default]}
    Preparing to download artifact org.knowm.xchart#xchart;3.5.4!xchart.jar
    Preparing to download artifact de.erichseifert.vectorgraphics2d#VectorGraphics2D;0.13!VectorGraphics2D.jar
    

    Room for improvement, certainly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions