You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Chetan Mehrotra <ch...@gmail.com> on 2012/10/06 21:09:06 UTC

Maven Bundle Plugin - Marking packages from optional dependencies as required

In Apache Jackrabbit Oak project the various modules are configured as
OSGi bundles. Same jars are also meant to be used in non OSGi
environment also. As OSGi related logic would not be used in such env
we need to mark such dependencies (say OSGi Core and Compedium jars)
as optional. However due to this the maven-bundle-plugin marks such
packages (org.osgi.framework) as optional which is not desirable.

Is there a way to disable this behaviour i.e. marking the packages
from optional dependencies as optional globally and instead allow one
to explicitly define the packages which are meant to be optional?

Chetan Mehrotra

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Maven Bundle Plugin - Marking packages from optional dependencies as required

Posted by Chetan Mehrotra <ch...@gmail.com>.
> If you have scope=provided, these bundles don't add to the transitive dependencies of oak-core and as such this suffi

Makes sense ... did not thought about that. Thanks for the solution!!

Chetan Mehrotra

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Maven Bundle Plugin - Marking packages from optional dependencies as required

Posted by Felix Meschberger <fm...@adobe.com>.
Hi,

I see. The problem is that you added the optional element.

If you have scope=provided, these bundles don't add to the transitive dependencies of oak-core and as such this suffices it.

The optional element is AFAICT only required to remove scope=compile dependencies from the transitive dependency space.

Regards
Felix

Am 09.10.2012 um 11:39 schrieb Chetan Mehrotra:

> Probably I was not clear before. So would try to explain it through an
> example. Have a look at oak-core [1]
> 
> 1. Non OSGi Usecase -  Any other Maven module which depends on
> oak-core should not require the osgi related jars at runtime. To
> support that case the org.osgi.core dependency has been marked as
> optional. Its fine to have the osgi metadata in the manifest file but
> osgi related jar should not be part of runtime classpath
> 
> 2. OSGi Usecase - In osgi env the packages related to osgi core should
> be required and not marked as optional
> 
> Now if I mark the org.osgi.core dependency as optional (#1) the
> maven-bundle-plugin would mark packages from it as optional which
> conflicts with #2. So I am looking for a way to achieve both #1 and #2
> 
> Chetan Mehrotra
> 
> [1] https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core/pom.xml
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Maven Bundle Plugin - Marking packages from optional dependencies as required

Posted by Chetan Mehrotra <ch...@gmail.com>.
Probably I was not clear before. So would try to explain it through an
example. Have a look at oak-core [1]

1. Non OSGi Usecase -  Any other Maven module which depends on
oak-core should not require the osgi related jars at runtime. To
support that case the org.osgi.core dependency has been marked as
optional. Its fine to have the osgi metadata in the manifest file but
osgi related jar should not be part of runtime classpath

2. OSGi Usecase - In osgi env the packages related to osgi core should
be required and not marked as optional

Now if I mark the org.osgi.core dependency as optional (#1) the
maven-bundle-plugin would mark packages from it as optional which
conflicts with #2. So I am looking for a way to achieve both #1 and #2

Chetan Mehrotra

[1] https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core/pom.xml

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Maven Bundle Plugin - Marking packages from optional dependencies as required

Posted by Felix Meschberger <fm...@adobe.com>.
Hi,

Am 06.10.2012 um 21:09 schrieb Chetan Mehrotra:

> In Apache Jackrabbit Oak project the various modules are configured as
> OSGi bundles. Same jars are also meant to be used in non OSGi
> environment also. As OSGi related logic would not be used in such env
> we need to mark such dependencies (say OSGi Core and Compedium jars)
> as optional. However due to this the maven-bundle-plugin marks such
> packages (org.osgi.framework) as optional which is not desirable.

I do not completely understand your problem: When using bundles in a non-OSGi setup, the OSGi manifest headers are just ignored. Particularly the Import-Package header is just not used. So there is no problem with this header.

Also, in an OSGi context, these dependencies generally are not optional, unless carefully reviewed. So marking them optional for the sake of non-OSGi setups is probably error prone.

Regards
Felix

> 
> Is there a way to disable this behaviour i.e. marking the packages
> from optional dependencies as optional globally and instead allow one
> to explicitly define the packages which are meant to be optional?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org