Software Defined Networking
1753818 Members
8203 Online
108805 Solutions
New Discussion

Re: Help with maven/osgi build issue!

 
NewToSDNProgram
Occasional Advisor

Help with maven/osgi build issue!

Hi everyone,

 

Not being too familiar with maven, and even less so with how to package stuff properly for osgi bundles i've been hitting a dead-end trying to include another third-party jar dependency in my project. I have followed the standard project template for the 2.3.5 controller and have the various maven projects setup correctly (api, app, bl, model, root, rs, ui). Now, the problem is that I have included another external dependency in my bl project. The project compiles and even builds fine. In the "app" pom.xml I have even included the third-party maven jar to be copied from my local maven repository to the bundle. However, whenever I try to deploy to the SDN Controller I receive the following error message:

 

"Error uploading application archive;cause: No matching artifact for ...."

 

I think the problem now lies in that I need to tell osgi about this jar. I know that I need to include this information somehow in the maven build plugin named 'maven-bundle-plugin' of the pom.xml in root project. Can any gurus with osgi bundling help me out? Thanks!

 

-David

6 REPLIES 6
Carlos
Frequent Advisor

Re: Help with maven/osgi build issue!

David,

 

At the moment I am researching your issue with our engineering department. Once I get an answer from our team I will contact you.

 

Best Regards,

 

Carlos

CSC CoE SDN

 

ScottReeve
Advisor

Re: Help with maven/osgi build issue!

David,

Have you tried building a simple skeleton app to see if it loads?

 

[Putting detail in here for any/all to see]

 

./bin/gen-sdn-app --template skeleton --directory ~/sdn-hm/  --app hm --company mango --subject DeviceHealth --app-name "Device Health Monitor" --company-name "Mango Networks" --description "Application for controlling a network of devices." --rest-path health

 

cd ~/sdn-hm/hm-root

 

mvn clean install

 

cd ..

 

load the file:

 

./hm-app/target/hm-1.0.0-SNAPSHOT.zip

 

into the controller and see if it loads/deploys.

 

Also: have you tried building/loading without the additional external dependency?

 

Just trying to isolate the problem.

 

Scott

 

 

 

 

 

NewToSDNProgram
Occasional Advisor

Re: Help with maven/osgi build issue!

Hi Scott,

 

I have no problems building my app (based on the template maven apps) without the external dependency, I can even compile everything in Eclipse without any problems and the maven build runs without errors. The problem comes when I need to include the third-party dependency and deploy to the Virgo server, then it launches the previous error. I need to figure out how to tell that maven-bundle-plugin to include the third-party dependency (which is already mavenized btw) in the osgi bundle descriptors/system. Thanks for any help!

 

-David

NewToSDNProgram
Occasional Advisor

Re: Help with maven/osgi build issue!

Hi Carlos,

 

Any luck with this? Thanks!

 

-David

Carlos
Frequent Advisor

Re: Help with maven/osgi build issue!

David,

 

Scott is already working on this forum. He will address any questions you have in regards to maven/osgi.

 

Best Regards,

 

Carlos

 

CoE SDN

NewToSDNProgram
Occasional Advisor

Re: Help with maven/osgi build issue!

To anybody else that was having the same issue, the solution I found is the following:

 

1.) Include any third-party jars as maven dependencies in each sub-project as needed (normal Maven procedure).

 

2.) In the pom.xml in the XXXXXX-root project, add the following line as shown below into the maven-bundle-plugin plugin section

 

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.6</version>
<extensions>true</extensions>
<configuration>
<instructions>

<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>

 

----ADD THIS LINE BELOW ----
<Embed-Dependency>YOUR_MAVEN_ARTIFICAT_NAMES_SEPERATED_BY_COMMAS</Embed-Dependency>

--------------------------------

 

</instructions>
</configuration>
</plugin>

 

The third party maven dependencies will then be automatically included and you can deploy the project now. Good luck!

 

-David