4 Replies Latest reply on Nov 25, 2009 11:20 AM by kukeltje

    Groovy language in Script activity

      Hello,

      The jBPM says a little on how to use another script language in a Script activity.
      It seems you have to add something like this, as child element of the script-manager XML element in the jbpm.cfg.cml file:

      <script-language name="..." factory="..."/>

      for the language you want.

      How can I define Groovy? And what interface the class defined in factory attribute is supposed to support?

      Thank you,


      Bertrand.

        • 1. Re: Groovy language in Script activity
          kukeltje

          it needs to be compliant with JSR 223

          • 2. Re: Groovy language in Script activity

            Hello,

            I would be happy to do some tests, but I don't know what I can use for the "factory" attribute? Any idea?

            Thank you,

            Bertrand.

            "kukeltje" wrote:
            it needs to be compliant with JSR 223


            • 3. Groovy in Script activity works, but lang attribute seems to

              After some search, I've found how to proceed. The class to use is org.codehaus.groovy.jsr223.GroovyScriptEngineFactory.

              - I added this declaration (in bold) in the jbpm.cfg.xml:

              <script-manager default-expression-language="groovy"
              default-script-language="groovy">
              <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
              <script-language name="groovy" factory="org.codehaus.groovy.jsr223.GroovyScriptEngineFactory" />
              </script-manager>

              - You have to have the groovy-all-....jar in your libs

              So you use Groovy in a script activity; for example:

              <script name="display hello world" lang="groovy"
              expr="println 'Salut !'">



              But with some test, I see that the lang attribute value is not take in account; and the only way to have Groovy to be executed is to set it as default as I do it above in script-manager XML element.

              Is it a bug?


              Cheers,

              Bertrand.


              "bgoetzmann" wrote:
              Hello,

              The jBPM says a little on how to use another script language in a Script activity.
              It seems you have to add something like this, as child element of the script-manager XML element in the jbpm.cfg.cml file:

              <script-language name="..." factory="..."/>

              for the language you want.

              How can I define Groovy? And what interface the class defined in factory attribute is supposed to support?

              Thank you,


              Bertrand.


              • 4. Re: Groovy language in Script activity
                kukeltje

                Could be... I'll have a look in the source tonight to check