JUnit tests pass, but fail when run with Maven test and gives ProcessEngineException: unable to load script file from resource xx.groovy

3,796 views
Skip to first unread message

Hans

unread,
Oct 10, 2014, 12:55:08 PM10/10/14
to camunda-...@googlegroups.com

(Complete Maven, JUnit, Camunda newb here, so pardon my question if the answer is obvious)

So I have a JUnit test for two processes deployed to RuntimeService:

Below is dependency for documentReview process in the Enrollment process's pom.xml, 

<dependency>
<groupId>otpp.workflow</groupId>
<artifactId>process.documentReview</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>


When I try Run as Junit, the test passes with no problem. But when I try a Maven build with clean test goal, the test fails and giving me the following error: 



Martin Schimak

unread,
Oct 10, 2014, 1:26:44 PM10/10/14
to camunda-...@googlegroups.com
Hi Hans.

I don't know your exact setup, but I would guess that the problem could arise from the fact that you put your script file "isDocReviewRequired.groovy" beneath an e.g. src/main/groovy folder - which is meant to be compiled to a *.class file. Typically the junit test runners of IDEs - like Intellij in my case - can still see such groovy source files as resources in the class path, but not maven. Maven will do it "cleaner" and just put the compiled *.class file inside your target folder. My solution so far is that I put such groovy files in the src/main/resources folder - then maven will bundle them into the target folder as any other resource. As a result the process engine can see and reference them as a resource, too. In Intellij IDEA I am still able to edit and test such src/main/resources groovy scripts/classes like any other class… but I don't know how eclipse behaves in that case…

Probably another, better?, solution would be to declare the groovy source folder as a resource folder for maven.

Does this help in your case, Hans? In any case, I would appreciate feedback how other people deal with the issue I describe.

Many greetings,
Martin.
--
You received this message because you are subscribed to the Google Groups "camunda BPM users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/54f88117-93fd-4a14-b4bc-6840dd8a39b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hans

unread,
Oct 10, 2014, 2:00:41 PM10/10/14
to camunda-...@googlegroups.com
Hi Martin, 
It turns out to be a Maven setup problem. You are right, and thanks for pointing me to the right direction. 
Cheers, 
Hans

Hans

unread,
Oct 10, 2014, 3:34:33 PM10/10/14
to camunda-...@googlegroups.com
Hi Schimak, 
Just solved the packaging problem, now I have a DocReview.bpmn file in the test-jar: below is the test jar file









The "isDocReviewRequired.groovy" file is actually a script task in the DocReview process. And I thought maven should find it fine but I still get the same problem. 
Where is maven looking for the groovy file? 

Cheers, 
Hans

Martin Schimak

unread,
Oct 11, 2014, 6:26:46 AM10/11/14
to camunda-...@googlegroups.com
Hi Hans,

The script source(!) file just must be visible on the classpath. So in your jar you show here you should see it right alongside the bpmn...

Cheers
Martin.
Reply all
Reply to author
Forward
0 new messages