简体   繁体   中英

Solving dependency google (com.google.common.base) in karaf

I have one project in karaf (version 3.0.3) with multi modules. I neeed the dependecies to one module - google-http-client.

<dependency>
  <groupId>com.google.http-client</groupId>
  <artifactId>google-http-client</artifactId>
  <version>1.30.2</version>
</dependency>

In running karaf I found the error with com.google.common.base

Unable to resolve 367.0: missing requirement [367.0] osgi.wiring.package; (&(osgi.wiring.package=com.google.api.client.http)(version>=1.30.0)(!(version>=2.0.0))) [caused by: Unable to resolve 368.0: missing requirement [368.0] osgi.wiring.package; (&(osgi.wiring.package=com.google.common.base)(version>=26.0.0)(!(version>=27.0.0)))]

To solve the problem with com.google.common.base i use the package google guava . In maven-bundle-plugin I import the guava package.

I checked the MANIFEST file and had the next versions to packages, but now I have the same error. Can you help me, please?

com.google.api.client.http; version="[1.30,2)"

com.google.common.base;version="[26.0,0)"

My Solution : To solve this problem, I changed the google http client version (lower)...

These dependencies all seem to be OSGi bundles already. So do not embed them and instead install them bundles with their maven coordinates.

Try to install google-http-client in Apache Karaf using the install -s mvn:... command. It will show you the packages this bundle needs. Then install the dependencies in the same way until you get no more resolve error.

Then put these dependencies in a feature file together with your bundle so next time installation is easier.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM