How to use grape with groovy?

Hi all,
I am new to openhab. I have experience with Jenkins and groovy.
I want to use some dependencies in my groovy rule. I am trying to use grape. But it is failing due to missing ivy.
Can I somehow use grape in groovy with opehab?
How is the class loading working in rule. Is it per rule?

Can I add ivy jar to addon or script directory so that it will be added to the classpath of the groovy script engine?

You can add an OSGi manifest to a JAR so it becomes a bundle which you can install and use.

See:

I currently don’t know maven and bnd. The only osgi I know is the eclipse pde env with build properties and ant build.
Could you please help me to build your project? I see a bnd and pom xml.
So if I need to use grape, I need to add the dependency in pom xml right?

I currently don’t know maven and bnd. The only osgi I know is the eclipse pde env with build properties and ant build.
Could you please help me to build your project? I see a bnd and pom xml.
So if I need to use grape, I need to add the dependency in pom xml right?

I have solved the issue.
Here is what I did.
download bnd-platform for gradle from github, https://github.com/stempler/bnd-platform-minimal.

add ivy dependency. and created the bundle
install the generated bundle to openhab with bundle install command.
use grape to resolve classes.

now it is working. :smile: I have not identified the ivy download location yet.

2 Likes