3rd Party Jar imports URCaps

I’m quite a new URCap developer trying to figuring things out.
Currently i’m having some trouble with importing a 3rd Party Jar( specifically EasymodbusTCP Modbus Library for .NET/Java and Python – Communication library and professional tools for industrial communication ).

Just to explain my current project. I’m trying to control a Festo drive with an URCap through with the modbus protocol. Currently it’s done with a python daemon cap but i’m moving it to a java only project.

I’ve made a maven project excluding the UR library and this builds and installs normally ( ofcourse the pom script is way smaller, but it proved to me that maven succesfully imported the jar)

I’ve tried to import the same dependency script


When i add this to a ( working ) fresh URCap and run ‘mvn clean install’.
I get the following error :

[INFO] ----------------------< com.forfoxsake:festocap >-----------------------
[INFO] Building festocap 1.0-SNAPSHOT
[INFO] -------------------------------[ bundle ]-------------------------------
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ festocap ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] --- maven-compiler-plugin:3.6.0:compile (default-compile) @ festocap ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /home/ur/Documents/com.forfoxsake.festocap/target/classes
[INFO] --- maven-bundle-plugin:2.4.0:manifest (bundle-manifest) @ festocap ---
[WARNING] Manifest com.forfoxsake:festocap:bundle:1.0-SNAPSHOT : Unused Import-Package instructions: [com.ur.urcap.api*, de.re.*] 
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ festocap ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/ur/Documents/com.forfoxsake.festocap/src/test/resources
[INFO] --- maven-compiler-plugin:3.6.0:testCompile (default-testCompile) @ festocap ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /home/ur/Documents/com.forfoxsake.festocap/target/test-classes
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ festocap ---
[INFO] -------------------------------------------------------
[INFO] -------------------------------------------------------
[INFO] Running com.forfoxsake.festocap.impl.AppTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.108 s - in com.forfoxsake.festocap.impl.AppTest
[INFO] Results:
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] --- maven-bundle-plugin:2.4.0:bundle (default-bundle) @ festocap ---
[WARNING] Bundle com.forfoxsake:festocap:bundle:1.0-SNAPSHOT : Unused Import-Package instructions: [de.re.*, com.ur.urcap.api*] 
[INFO] --- maven-assembly-plugin:2.2-beta-5:single (default) @ festocap ---
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] Building jar: /home/ur/Documents/com.forfoxsake.festocap/target/festocap-1.0-SNAPSHOT-jar-with-dependencies.jar
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] --- exec-maven-plugin:1.1:exec (package-urcap) @ festocap ---
[INFO] cp: missing destination file operand after 'target/festocap-1.0-SNAPSHOT.jar'
[INFO] Try 'cp --help' for more information.
[INFO] /bin/sh: 2: target/festocap-1.0-SNAPSHOT.urcap: not found
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.074 s
[INFO] Finished at: 2019-07-01T05:43:41-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1:exec (package-urcap) on project festocap: Result of /bin/sh -c cd /home/ur/Documents/com.forfoxsake.festocap && cp target/festocap-1.0-SNAPSHOT.jar
[ERROR] 								target/festocap-1.0-SNAPSHOT.urcap execution is: '127'.
[ERROR] -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException`

And the strange this is, when i remove the dependency from the Pom file it still gives the same error.

Now as i am new to the world of Maven and UR i fail to understand the problem here, it says the program couldn’t cp something because the destination file was missing. So implying it couldn’t create the file?

I’ve look at every 3rd party jar post on this forum and tried them all but i get the same result. I feel like i’m missing something very important but i can’t figure out what and i don’t want to waste more time on it.

I’ll add the Pom files with the attemts to fix it when i get to work.

Ps. I’ve looked at the following forum posts :



I recognize the problem that you are getting:

This happened for me when there are shiftings in the code lines in the pom.xml file - like the following picture:

or this:

To make the error disappear i made sure to have the “CommandlinArgs” on the same line -->

Has to be consistent in the whole pom.xml file. This happens a lot to me when I try to auto-format the code. Hope it fixes the “Build” problem.


Oh lord. Feels really stupid when you’ve been stuck on something for a few days and this turns out to be the error… Guess that’s programming for ya.

Thanks a lot thph!!


Hello! I tried using the easymodbustcp 3rd party jar to read data from a modbus server to show in polyscope. But once I start writing code with functions from this, the GUI disappears from the ursim. The code compiles successfully. Did you ever come across a problem like this?

I downloaded the easymodbustcp from the webside, and used properties->libraries->add external JARs. Then I added
< dependency>
< groupId>de.re< /groupId>
< artifactId>easymodbus.modbusclient< /artifactId>
< version>1.0< /version>
< /dependency>

To the pom file

Hello !
I have not tried where the GUI disappears in the ursim sadly but could you provide me with the Website where you downloaded the jar file and perhaps the function that you used for your code - or code snippet ? (Sometimes the problems lies in how you have included the jar)

I used this site to download the jar file, I have moved it into the resources folder in the URCap:

Just to check if I included the jar file correctly, I wrote this short code inside my BuildUI
Screenshot from 2020-07-07 22-37-20

I am not familiar with pom files, so the problem might be there. This is the code I added:
Screenshot from 2020-07-07 22-41-21

Thank you for helping

I added these lines to the pom.xml file, and now the URCaps appear in ursim

But now I get this error below. It does not seem to find the class I have used, but it is hopefully something small I have missed with importing the jar file. Anyone got an idea?

java.lang.NoClassDefFoundError: de/re/easymodbus/modbusclient/ModbusClient

So I did use another but almost the same approach:

  1. I installed the jar file to the local maven repository by executing the following command from the terminal (Have to direct to where your jar file is) - you can use the command directly without modification if you jar file has the name EasyModbusJava.jar:

mvn install:install-file -Dfile=EasyModbusJava.jar -DgroupId=de.re -DartifactId=easymodbus.modbusclient -Dversion=1.0 -Dpackaging=jar

it should look something like this:

In my pom.xml file I have the modbus included (please ignore other dependencies):


And my manifest file looks like this:

Here you notice the Bundle-Classpath and Embed-Dependency and Embed-Artifacts contains the easymodbus.modbusclient. Hope it works for you too! Else let me know if something is unclear.

I tried starting all over with your approach, and it looked to be working. The manifest file looks the same and the easymodbus.modbusclient.jar is inluded in the .urcap package. But now the URCap does not show up in ursim at all, even when I am not using modbus in the code. Did you try running it in ursim with some code?

Yes I got this print out that it worked because i tried the code you have provided with a fake socket call to random port and IP.

But I may know your reason for it to not show up in ursim. Do you get the follwoing in the terminal when starting up the ursim ?

and when you look at your URCap installation do you see the following warning sign?

Yes, I get the same “Error starting bundle” and warning sign

Nice, so the “osgi.wiring.package=gnu.io” indicates that you are missing this package because the modbus library uses this. So you have to google and figure out which jar has this package but I have already done that. So you can download this jar for this link and run the following command from the directory of the jar:

mvn install:install-file -Dfile=rxtx-2.1.7.jar -DgroupId=gnu.io -DartifactId=gnu -Dversion=2.1.7 -Dpackaging=jar

and include this dependency:


and include this embed dependency:


Hope it works.

It looks like it is working perfectly. Thank you for the help!

1 Like

Hi, I have followed the steps to install the easymodbus library and I have come to where polyscope does not recognize the gnu.io file. but I get an error message instead of a warning. I have downloaded the file, installed it and included the dependency / embed dependency but it continues without recognizing it.
any idea why it can happen?
error lib gnu.io