How to use the third-part .jar files?

The problem with that asterisk (as far as I understand) is that it will tell the OSGi framework that all those dependencies are already installed and available in the classpath, which is not the case. If you take a look at where you installed the simulator, you should find the jars corresponding to urcap.api somewhere (look in GUI/bundle).

You could try two things:

  • Paste those jars (your dependencies) in that directory too, leaving the POM as is and see what happens (I never tried that personally, but maybe it works)
  • Try something like this:
                        < Import-Package>
                            com.ur.urcap.api*;version="[1.1.0,2.0.0)", org.osgi.*, javax.*
                        < /Import-Package>
                        <!-- This is a workaround to create a manifest that is accepted by URSIM -->
                        < Embed-Dependency>com.thoughtworks.xstream.*< /Embed-Dependency>

Then, add the maven-assembly-plugin to the POM:

            < plugin>
                < artifactId>maven-assembly-plugin</artifactId>
                < configuration>
                    < descriptorRefs>
                         < descriptorRef>jar-with-dependencies</descriptorRef>
                    < /descriptorRefs>
                < /configuration>
                < executions>
                    < execution>
                        < phase>package</phase>
                        < goals>
                            < goal>single</goal>
                        < /goals>
                    < /execution>
                < /executions>
            < /plugin>

When you run mvn install, you should see a file with the classes of your dependency packed inside, and the usual .urcap file with the correct manifest. Get the manifest from the .urcap file into the jar with dependencies, change the extension to .urcap, and try using it. I did that and it works (you can use something to automate extracting the manifest from one file to the other and changing the extension).

2 Likes