Quantcast
Viewing all articles
Browse latest Browse all 2218

How to add a library dependency to the java service modules?

Hi,

 

I am trying to add Google gson jar as a dependency to the chassis sample (/chassisRackVSphere-service) and I am running into some issues with the osgi setup.

 

////////////////////////////////////////////////////////////////////////////////////////

Resolver report:

        An Import-Package could not be resolved. Resolver error data <Import-Package: com.google.gson; version="0.0.0">. Caused by missing constraint in bundle <com.vmware.samples.chassisrackvsphereservice_1.0.0>

             constraint: <Import-Package: com.google.gson; version="0.0.0">

 

  at org.eclipse.virgo.kernel.install.pipeline.stage.resolve.internal.QuasiResolveStage.process(QuasiResolveStage.java:46)

  at org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipeline.doProcessGraph(StandardPipeline.java:62)

  at org.eclipse.virgo.kernel.install.pipeline.internal.CompensatingPipeline.doProcessGraph(CompensatingPipeline.java:73)

  at org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage.process(AbstractPipelineStage.java:41)

  at org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipeline.doProcessGraph(StandardPipeline.java:62)

  at org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage.process(AbstractPipelineStage.java:41)

  at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.driveInstallPipeline(PipelinedApplicationDeployer.java:359)

////////////////////////////////////////////////////////////////////////////////////////

 

Here are the things that I did in service of adding the  gson-2.2.4.jar to the list of libraries (that I will be using from my service module).

 

1. Added gson-2.2.4.jar to chassisRackVSphere-service\lib

2. Added gson-2.2.4.jar to the list of referenced libraries in STS.

3. Fixed the ANT build file to add this jar to the classpath

 

<target name="compile-java" depends="clean" description="Do not select this internal target.">

      <javac includeantruntime="false" destdir="${CLASSES}" fork="true" debug="on">

         <src path="${basedir}/src/main/java"/>

         <!-- <src path="${basedir}/src/test/java"/> for future test files -->

         <classpath>

            <!-- remove this if you are not using the SDK on the java side -->

            <pathelement path="${VSPHERE_SDK_HOME}/libs/vsphere-client-lib.jar"/>

          <pathelement path="lib/commons-logging-1.1.1.jar"/>

          <pathelement path="lib/gson-2.2.4.jar"/>

         </classpath>

      </javac>

   </target>

 

4. Fixed the manifest file to include the gson package

 

/////////////////////////////////////////////////////////////////////////////////////////

Import-Package: org.apache.commons.logging,

com.google.gson,

com.vmware.vise.data,

com.vmware.vise.data.query,

com.vmware.vise.data.uri,

com.vmware.vise.vim.data

/////////////////////////////////////////////////////////////////////////////////////////

 

 

I am not sure what I am missing. How do I add third party libraries to the service module (in this case chassisRackVSphere-service)? Any help is appreciated.

 

Thank you

Shankar


Viewing all articles
Browse latest Browse all 2218

Trending Articles