renatoathaydes / osgi-run

Osgi-Run - A Gradle plugin to make the development of modular applications using OSGi completely painless
Apache License 2.0
54 stars 13 forks source link

Exclude bundles from osgiRuntime #23

Closed thugcee closed 8 years ago

thugcee commented 8 years ago

Hi Is it possible to instruct osgi-run to not install some bundles in started OSGi container? I have a big dependency tree with some packages not needed actually, but calculated as necessary.

renatoathaydes commented 8 years ago

Hi!

Have you tried excluding the dependencies in the gradle file?

Something like this:

dependencies {
    osgiRuntime "my-bundle:with-transitive-dependencies:1.0", {
        exclude group: 'bundl-group-to-be-excluded'
    }
}

I've never tried this , but I expect this to work because osgi-run uses Gradle's configurations to figure out dependencies and install bundles in the OSGi runtime.

If it doesn't work, I think it can be considered a bug.

thugcee commented 8 years ago

That didn't work in my case (osgiRuntime was correct and runtime contained unwanted dependencies), but you pointed me in right direction and I've found the solution, thank you :)

My solution was to add:

configurations {
    ...
    runtime.exclude group: 'org.apache.poi' // unwanted dep.
    runtime.exclude group: 'org.mockito'  // unwanted dep.
}
renatoathaydes commented 8 years ago

@thugcee cool!