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

Do not include jars for packages starting with 'osgi.*' in bundles directory #28

Closed tobias-- closed 8 years ago

tobias-- commented 8 years ago

When using dependencies like osgi core or compendium, they should not be included in the osgi/bundle directory.

For example:

    compile 'org.osgi:osgi.core:6.0.0'
    compile 'org.osgi:osgi.cmpn:6.0.0'

Results in having osgi.cmpn-6.0.0.jar and osgi.core-6.0.0.jar in osgi/bundle. The main output also complains about not being able to start the bundle (and that is perfectly right, in my opinion):

  ERROR: Bundle osgi.cmpn [11] Error starting file:[...]/build/osgi/bundle/osgi.cmpn-6.0.0.jar     (org.osgi.framework.BundleException: Unable to resolve osgi.cmpn [11](R 11.0): missing requirement [osgi.cmpn [11](R 11.0)] osgi.compile.time.only; (&(must.not.resolve=*)(!(must.not.resolve=*))) Unresolved requirements: [[osgi.cmpn [11](R 11.0)] osgi.compile.time.only; (&(must.not.resolve=*)(!(must.not.resolve=*)))])
org.osgi.framework.BundleException: Unable to resolve osgi.cmpn [11](R 11.0): missing requirement [osgi.cmpn [11](R 11.0)] osgi.compile.time.only; (&(must.not.resolve=*)(!(must.not.resolve=*))) Unresolved requirements: [[osgi.cmpn [11](R 11.0)] osgi.compile.time.only; (&(must.not.resolve=*)(!(must.not.resolve=*)))]
    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4111)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2117)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1371)
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
    at java.lang.Thread.run(Thread.java:745)
renatoathaydes commented 8 years ago

This is already possible, but you need to explicitly do it, as I did in this commit:

https://github.com/renatoathaydes/osgi-run/commit/a0f8cc990d4613c1d96e4e8ab6ccf6c81d8af49b

Hope this is ok for you.

tobias-- commented 8 years ago

Using excludedBundles = [ 'osgi.*' ] works for me. Thanks!

renatoathaydes commented 8 years ago

Great! I wanted to make this the default, but I thought this might break some deployments in certain cases (most likely many cases).

Making this explicit lets you control exactly what you want to be in and out of your environment.

I need to add a note on the README page about this.