I am trying to connect to a database in a JFUSE project. I included the com.mysql.jdbc dependency in the pom file, and the project build works fine. But then I ran into this annoying problem. When I try to install the package on OSGi, the installation failed:
Unable to run mvn package: com.info.demo / demo-rest / 1.0: Unresolved const raint in com.info.demo.rest bundle [363]: Unable to resolve 363.0: missing requirement [363.0] osgi.wiring.package; (Osgi.wiring.package = com.mysql.jdbc)
I tried all available solutions from SO, but they did not solve the problem. While I was trying to find the cause of the error, I saw a warning in the mysql dependency declaration in the IDE that states:
Maven Dependency Not Ready for OSGi
So, I think the main reason is that my dependency is not ready for the OSGi container. Can someone help me how to get OSGi to work with maven?
Below is my pom.xml code:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
***Project specific declarations here***
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.1.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Fragment-Host>org.springframework.jdbc</Fragment-Host>
<Import-Package>com.mysql.jdbc</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.mysql.jdbc</groupId>
<artifactId>com.springsource.com.mysql.jdbc</artifactId>
<version>5.1.6</version>
</dependency>
***Other Dependencies***
</dependencies>
Edit:
I followed Christine's suggestion and it works great. But I need to add other dependencies that are not ready for OSGi.
I used the installation of OSGi dependencies on the FUSE server. As well as dependency wrapping, but did not solve the problem.
Please help me with a detailed solution, Im really stuck here.
source
share