Hello Felix,
as you suggested ( I start a new topic here for Groovy4Capella…
I managed to get Groovy4Capella working - thank you!
… with some small difficulties:

  • installing eclipse-plugins, especially behind a firewall (for future releases: dropins are the “easiest” way to install add-ons)
  • the example script won’t run without an “Argument” definition in the Run-Configuration for the script
    So some first questions:
  1. List ExchangeItems per architecture level (System, Logical, Physical)
    In your example the Functions of the Logical-Architecture and Physical-Architecture are found by LogicalFunction.each PhysicalFunction.each.
    If I look for ExchangeItem.each all EIs are found - from every level. How can I select only one specified level e.g. LogicalArchitecture?
  2. Add/Write a new ExchangeItem to the model
    How can I add a new EI to the model at a defined location e.g.
    LogicalArchitecture -> Interfaces -> NewInterfacePgk -> NewExchangeItem
  3. Groovy & Excel
    Is Groovy able to directly read from / write to Excel files?
    kind regards

You can write/read from Excel using for example
It’s powerful lib and you can use it for other type of MST documents (Word, PPT, …)

Richard, great you got it installed
I am not a big fan of dropins. A firewall does not mean you cannot install from a p2 update site. You just need a .zip that contains that update site, and then you can install it from your local file system.

  1. there are tons of ways to do this
    . You could try to find the LA, PA, SA elements first, and then maybe use the method EcoreUtil.isAncestor(EObject ancestorEObject,
    EObject eObject) to see if a given element is a child of any of these architectures… Maybe I can add a helper when I have time. Could be useful.
  2. First you need to have the element to which you want to add the new EI. You can then create the EI with the factory method: InformationFactory.eInstance().createExchangeItem(). Then need to add the exchange item to the interface.
  3. See EL Arbi’s anwswer, maybe we can add an example for this too.
    Really, the main problem is time… I would be happy to have people write more examples so we can add them to the repo…

Hello all together,
I have downloaded the poi-lib - how do I have to “install” it so I can use it with capella-groovy?

Hello Felix (or anyone who can help with this)
some more questions…
concerning 2) “add a new EI to the model at a defined location e.g. PhysicalArchitecture”
You mentioned to use
How have I to use it? Can you give an example? (Im sorry, I am not a Java or groovy-coder…)
4) To go further - what are the methods to

  • generate (System/Locical/Physical)Functions
  • generate Function Input/Output Ports in a Function
  • generate a FunctionalExchange between two Ports
  • assigning an ExchangeItem to a FunctionalExchange

  • In general where can I find information about how to do these things?
    Kind regards

Hello Felix,
have you continued your work on Groovy4Capella? Can you provide an updatesite-snapshot compatible with Capella-1.3.0?
Kind regards

Hello Felix,
thank you for your help.
I have the problem that I am behind a firewall - I can not directly access a maven repository on the Internet with eclipse/capella.
Is there any other way to use the local jar-libs?

Ok I see. Well, I looked at the capella groovy code, and it seems I added support for local libraries at some point. I didn’t remember. So I tested, and I can run a poi example script just fine. What I did was:

  • Create a new ‘capella.groovy.example’ project.
  • Inside the project, select new->folder, and under ‘advanced’, select “link to external” and pick the folder containing the poi libs (I downloaded this here:
  • I then open the projects META-INF/MANIFEST.MF file, and on the “Runtime” tab, select Add… on the part with the “Classpath” header. I add all the .jar files in the poi folder (and also the lib subfolder and the ooxml-lib subfolder). I save that. I now see all these jar files under the “Referenced Libraries” pseudofolder in the project.
  • I can now run a script that has:
    package capella.groovy.example
    import groovy.transform.BaseScript
    Workbook wb = WorkbookFactory.create(new FileInputStream(“C:\Users\felix\Documents\Book1.xlsx”))
    info wb.getSheetAt(0).getSheetName()
    Maybe you forgot to add the other libraries, or the import org.apache…?

Hello Felix
this way it is working - thank you very much!
(I also had to add the commons-compress lib in the same way.)
I tried to add the libs in the projects “Properties” (mouse right klick on the Project) - this was not working.
The solution was to add the libs to the ClassPath in the MANFEST.MF
When I am outside the firewall the other solution with @Grab also is working - even better as the class-documentation ist available when hoovering with the mouse over a classname.

  1. To my former question - is Groovy already working with Capella 1.3? (the example is Capella-1.2.1)
  2. A more Capella-specific question:
    I can create a new Function and “place” it beyond (inside) a FunctionPackage with
    LogicalFunction NewLF = LaFactory.eINSTANCE.createLogicalFunction(“MyNewLF”)
    But how can I “place” a Function directly beyond another Function as a Sub-Function without a FunctionPackage? I haven’t found an “.add()” command, that is working on a Function.
    (I think this is the more usual way when working in Capella and creating new SubFunctions inside a Function.)
    Kind regards
  1. You could try with this build: /
    2) The pattern is always the same: aThing.getOwnedStuff().add(somethingElse). It is never aThing.add(somethingElse). so how to find out what ‘ownedStuff’ is? Many possible ways, but one is to just create an example model in capella and then open the .melodymodeller file in a text editor. In capella, the name of the xml tag is the name of the method. For your case, I create a LogicalFunction under the root function, and that xml looks like:
    So the method is ‘ownedFunctions’, and so you’d write:

Hello Felix,
thanks again!

  1. I will try…
  2. That was my mistake - I was assumed that a “LocicalFunction” owns a “LogicalFunction” not just a “Function”.
    Because the “LocicalFunction” owns for e.g. a “LogicalFunctionPkgs” not a “FunctionPkgs”…
    It is a very good hint to look at the xml-tags in the melodymodeller file!

Richard C. wrote on Wed, 27 February 2019 07:34
I was assumed that a “LocicalFunction” owns a “LogicalFunction” not just a “Function”.
Because the “LocicalFunction” owns for e.g. a “LogicalFunctionPkgs” not a “FunctionPkgs”…
Yes, there are inconsistencies, or at least ‘quirks’ in the Capella metamodel, so it’s better to look closely.

about 1)
again problems - I can’t get the groovy things from the installed - error message:

Cannot complete the install because one or more required items could not be found.
Software being installed: Groovy for Capella Developer Resources (
Missing requirement: Groovy for Capella ( requires ‘ 0.0.0’ but it could not be found
Cannot satisfy dependency:
From: Groovy for Capella Developer Resources (
To: []

Do you have an idea how I can fix this?

Hi, I tested to install and it works. My guess: Capella Groovy depends on Groovy Eclipse Development Tools, but does not explicitly include it in the update site. It rather references their own update site. If you’re behind a firewall, this won’t work. Try and download OB1/Zipped-Update-Site/org.codehaus.groovy-3.3.0.xx-20190301 Install the Groovy Eclipse Development Tools from that update site, and then retry with Groovy Capella.

Yes, that is working! Thanks!

The last (new) command of the example.groovy has a problem:

la.descendants().grep(ExchangeItem).each {
info it }

An internal error occurred during: “Capella Groovy Script Execution”.
No such property: ExchangeItem for class: capella.groovy.example.Example
Any Idea?

Oh, thanks, there’s a missing import in the example. Add
import* to the top (where the other import statements are) and then it works. I’ll fix the example.

Hello Felix,
I have another classpath(?) problem (or is it somewhere else?)…
When I generate a new class inside of the Example.groovy script there is no Problem to use this class inside of the script.
But when I transfer this class into an extra file I get an “unable to resolve class MyTestClass…” error.
The file is in the same directory and contains in the head the package definition…
file MyTestClass.groovy:
in Example.groovy
The code-completion is also working for this new class as expected and .class-files are generated for all classes in the ./bin/capella/groovy/example/ directory.
But I’m not able to run the script anymore.
So what am I missing here?

No I don’t thing it’s on your end. I think I have not done anything to make this case work. I will need to check.

Hello Felix,
did you have a look at it? I guess it is a “small” issue with groovy wrapping something around the classes as the classes result in both cases in class-files in the bin-directory.

Copyright © Eclipse Capella, the Eclipse Capella logo, Eclipse and the Eclipse logo are Trademarks of The Eclipse Foundation.