ctron / de.dentrassi.camel.milo

This component is now available in Camel 2.19.0
https://camel.apache.org
Apache License 2.0
7 stars 6 forks source link

Poissible Guava depencendy conflict #6

Open gbrost opened 7 years ago

gbrost commented 7 years ago

Hi Jens,

i have a dependency issue and am not sure how to solve it. Your bundle requires com.google.common.base, version >= 19 / < 20 which i have as part of Guava. Now we merged with some web console stuff that requires cxf, which requires version 18. When i have both installed, your bundle does not come up with this error:

Error starting bundle 159: Unable to resolve de.dentrassi.camel.milo.camel-milo [159](R 159.0): missing requirement [de.dentrassi.camel.milo.camel-milo [159](R 159.0)] osgi.wiring.package; (&(osgi.wiring.package=com.google.common.base)(version>=19.0.0)(!(version>=20.0.0))) Unresolved requirements: [[de.dentrassi.camel.milo.camel-milo [159](R 159.0)] osgi.wiring.package; (&(osgi.wiring.package=com.google.common.base)(version>=19.0.0)(!(version>=20.0.0)))]

I did some research and it might be guava that 18 and 19 do not get along with each other. When i uninstall guava 18, cxf does not work any longer, but this error goes away. Do you have a setup where those bundles get along with each other?

Update: I just saw camel 2.18 also comes with the guava 18 dependency in apache-camel-2.18.0-features.xml. Strange.

Karaf 4.0.5/Camel 2.18

Thanks Gerd

ctron commented 7 years ago

Yes .. I think the issue is that guava doesn't do semantic versioning. So 18.0.0 would be incompatible from 19.0.0. OSGi follows this principle pretty strongly and so the bnd plugin probably generated imports for [19,20).

As long as there are now overlaps, it would also be possible for OSGi to run both in parallel. But this not always the case. So it can come to the issue your reported.

I guess for guava we could simply ditch the upper bound.

gbrost commented 7 years ago

Do you mean the upper or lower bound? Could you run with guava 18?

Update: Ah i get it: You mean ditch the upper bound and install a current guava version to the 18.0 one?

ctron commented 7 years ago

I published a new version to Maven Central a few minutes ago (version 0.1.1). This should fix this issue.

It would be great if you could give it another try and let me know if this helps. Thanks!

gbrost commented 7 years ago

Hi,

when adding that to the pom.xml of our project, i get this when trying to build: [ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.5:assembly (default-assembly) on project offline-karaf: Unable to build assembly: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=de.dentrassi.camel.milo.camel-milo; type=osgi.bundle; version="[0.1.1,0.1.1]"; resolution:=mandatory [caused by: Unable to resolve de.dentrassi.camel.milo.camel-milo/0.1.1: missing requirement [de.dentrassi.camel.milo.camel-milo/0.1.1] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.apache.camel)(version>=2.17.0)(!(version>=3.0.0)))"] -> [Help 1]

This version >=2.17, !>=3.0.0 might cause problems.

ctron commented 7 years ago

It looks like you are missing camel altogether.

gbrost commented 7 years ago

And that is pretty strange. We have camel, we successfully used your .kar. But when i introduce your dependency into our pom.xml like so:

        <dependency>
            <groupId>de.dentrassi.camel.milo</groupId>
            <artifactId>camel-milo</artifactId>
            <version>0.1.1</version>
        </dependency>

it breaks...

Btw. it is directly in the pom.xml after:

       <dependency>
            <groupId>org.apache.camel.karaf</groupId>
            <artifactId>apache-camel</artifactId>
            <version>${camel.version}</version>
            <classifier>features</classifier>
            <type>xml</type>
            <!-- <scope>runtime</scope> -->
        </dependency> 
ctron commented 7 years ago

Yes, that only adds the features to the project. But you also need to add the feature camel-core. Depending in your setup it differs how to do this.

If you are running feature:install from the shell it will pull in this dependency automatically. If you are using the maven-karaf-plugin you will probably need to add this either as a dependency or in the plugin's configuration.