>>>>> Steinar Bang <s...@dod.no>:

[snip!]
>> What I would like to do, is to add the dependencies in
>> <scope>compile</scope> and let karaf-maven-plugin generate a feature
>> file from the compile dependencies, and then use that feature file in
>> the pax exam karaf config.
[snip!]
>> What I would like to do, is to add the dependencies in

> I tried adding mockrunner-server as a compile target:
>             <dependency>
>                 <groupId>com.mockrunner</groupId>
>                 <artifactId>mockrunner-servlet</artifactId>
>                 <version>1.1.2</version>
>                 <scope>compile</scope>
>             </dependency>

[snip!]
> The feature installs fine in a regular karaf console:
[snip!]

> But karaf in pax exam (that now has a <scope>compile</scope> dependency
> to mockrunner), fails during startup.  If I remove the compile
> dependency pax exam karaf starts fine.

> Is there a workaround to this issue?

Yes, there is: add an <exclude> to the dependency that pulls in the
conflicting xerces version:
        <dependency>
            <groupId>com.mockrunner</groupId>
            <artifactId>mockrunner-servlet</artifactId>
            <version>1.1.2</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.mockrunner</groupId>
                    <artifactId>mockrunner-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

I found it by running "mvn dependency:tree" which outputs the following
for mockrunner-servlet:
 [INFO] +- com.mockrunner:mockrunner-servlet:jar:1.1.2:compile
 [INFO] |  +- com.mockrunner:mockrunner-core:jar:1.1.2:compile
 [INFO] |  |  +- jdom:jdom:jar:1.0:compile
 [INFO] |  |  +- oro:oro:jar:2.0.8:compile
 [INFO] |  |  +- com.kirkk:jaranalyzer:jar:1.2:compile
 [INFO] |  |  |  +- bcel:bcel:jar:5.1:compile
 [INFO] |  |  |  |  \- regexp:regexp:jar:1.2:compile
 [INFO] |  |  |  +- jakarta-regexp:jakarta-regexp:jar:1.4:compile
 [INFO] |  |  |  \- ant:ant:jar:1.6.5:compile
 [INFO] |  |  \- nekohtml:nekohtml:jar:0.9.5:compile
 [INFO] |  |     \- xerces:xercesImpl:jar:2.4.0:compile
 [INFO] |  +- commons-logging:commons-logging:jar:1.0.4:compile
 [INFO] |  \- org.apache.tomcat:servlet-api:jar:6.0.37:compile

xerces, which is what the karaf boot message complained about is pulled
in by com.mockrunner:mockrunner-core:jar:1.1.2.

So I'm guessing what happens is that pax exam pulls in all compile scope
and test scope dependencies(*) and offer them up as exported osgi
packages to the pax exam test's OSGi runtime.  And if the packages are
in conflict with something else (in this case the karaf boot), there are
problems.

My original question was: Is it possible to create a karaf feature file
for use in a pax exam test, by adding compile scope dependencies to the
pax exam maven project and use karaf-maven-plugin to generate the
feature file?

The answer to my original question, is: Yes, but only for such top level
dependencies that won't conflict with other OSGi components running in
the pax exam OSGi runtime.  Beware of transitive dependencies of the
packages you're creating feature files for.


(*) I tried test scope as well, got the same boot error there


-- 
-- 
------------------
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to