Groovy scripts not accessible as deployment resources under camunda-spring-boot

Dear Community,

I am migrating a custom UI framework to 7.5.0-based camunda-spring-boot (tried 1.3.0 and 1.4.0-SNAPSHOT). The framework uses custom groovy scripts outside of BPM engine. I’ve placed the scripts in src/main/resources (next to the bpmn diagrams) and I see the scripts are available as classpath resources (for example, as Execution Listener of Script type specified as classpath://hello.groovy). However, the scripts are not available as deployment resources when the framework attempts to load them via org.camunda.bpm.engine.RepositoryService.getDeploymentResourceNames(deploymentId).
I’ve tried to set the following property in the application.properties, but it doesn’t help (not sure if this property is meant for this).
camunda.bpm.job-execution.deployment-resource-pattern=classpath:/.groovy

I am using default engine configuration provided by camunda-spring-boot (no custom config classes nor processes.xml).

With all that said, how do I force camunda-spring-boot to deploy the groovy scripts as deployment resources?

Thanks,
Sergii

Hi @stsymbal,

it is not clear for me what you want to achieve. You want your groovy scripts, which are used inside .bpmn diagram be available to your execution, or something else? May be you could publish an example on github?

Cheers,
Askar

I am not sure if I get the question correctly, because I never had this requirement so far. But resources are scanned according to their file-suffix so you could try configuring groovy as a valid extension via deployment-resource-pattern.

Hi Askar,

I apologize for not being clear. Our framework executes the groovy scripts via custom REST endpoints, not from within the process. However, the framework expects the groovy scripts to be loaded as Camunda deployment resources. The approach works with Activiti and earlier versions of “unbootified” Camunda, but it doesn’t work with the latest “bootified” Camunda.

Thanks,
Sergii

Hi Jan,

Is there a property for Spring Boot’s application.properties which can be used to configure this?
If not, how do I add groovy as a valid extension? Is it via processes.xml’s “additionalResourceSuffixes” property?
I am asking because we don’t have to do anything special about the groovy scripts with earlier versions of “unbootified” Camunda nor Activiti.

Thanks,
Sergii

Try to use the SpringBootProcessApplication and an empty processes.xml file.

@SpringBootApplication
@ProcessApplication 
public class MyApp extends SpringBootProcessApplication {
 ....
}

The spring auto-scan deployment is different from the camunda-processes.xml way.

Jan,

I’ve added “extends SpringBootProcessApplication” and @ProcessApplication to my spring boot app class and created an empty src/main/resources/META-INF/processes.xml, however my src/main/resources/hello.groovy script is still not being loaded. The only deployment resource I see is my src/main/resources/TestProcess.bpmn
Is there anything else I need to do?

Thanks,
Sergii

Sorry for confusing you … are you sure this worked without any additional configuration in the past? I never tried it so far (no matter if springboot or traditional).
camunda-process-application and spring-auto-deployment both scan the classpath for files with certain extensions, so adding groovy to the config might be the way.

Jan,

Let me double check. It could be Activiti vs Camunda differences.
I will keep you posted.

Thanks,
Sergii

@jangalinski
Sorry, my bad. In the past it worked with “bar” style of deployment, i.e. it never actually added groovy scripts as deployment resources automatically. So, empowered by this finding, I’ve been able to create a deployment via REST API with both bpmn and groovy resources specified and our framework was able to find the groovy file. However, It was not able to execute it (due to NPE at org.camunda.bpm.engine.impl.scripting.engine.ScriptingEngines.getScriptEngineForLanguage(ScriptingEngines.java:101)), but that’s a different issue for another post.

What I am trying to understand now is how additional deployment-resource-patterns should be specified without a custom instance of ProcessEngineConfigurationImpl bean.

I’ve tried to add the following property to application.properties

camunda.bpm.deployment-resource-pattern=classpath*:**/*.groovy,classpath*:**/*.bpmn

and it worked (loaded groovy scripts as deployment resources), but only after I removed empty processes.xml and removed “extends SpringBootProcessApplication” from my @SpringBootApplication class. Should it actually be the other way around (if I am reading the following doc correctly)?
https://camunda.github.io/camunda-bpm-spring-boot-starter/docs/current/index.html#properties

Thanks,
Sergii

In case anybody needs the “bar” style deployment on bootified Camunda with SpringAutoDeployment (simple @SpringBootApplication class without empty processes.xml). I was able to make it work with the following property in application.properties and the bar file in src/main/resources.

camunda.bpm.deployment-resource-pattern=classpath*:**/*.bar