You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Francesco Mari <ma...@gmail.com> on 2015/10/22 15:34:15 UTC

Why does oak-core import every package with an optional resolution?

Hi,

can somebody explain me why oak-core has the "Import-Package"
directive set to "*;resolution:=optional"?

The effect of this directive is that *every* imported package is
declared optional in the manifest file. Because of this, the OSGi
framework will always resolve the oak-core bundle, even if some of its
requirements are not satisfied. In particular, oak-core must always be
ready to cope with NoClassDefFoundExceptions.

We should definitely fix this.

Re: Why does oak-core import every package with an optional resolution?

Posted by Julian Sedding <js...@gmail.com>.
+1 for cleaning this up.

Quite a few dependencies are marked optional in maven and thus will
end up with resolution:=optional in the manifest anyway. Maybe that's
already good enough.

Maybe in the future the modules that require these optional
dependencies can be factored into their own bundles, thus obviating
the need for optionality of the dependencies all together.

Regards
Julian

On Tue, Oct 27, 2015 at 2:01 PM, Francesco Mari
<ma...@gmail.com> wrote:
> In the meantime, I logged OAK-3558.
>
> 2015-10-26 19:34 GMT+01:00 Julian Reschke <ju...@gmx.de>:
>> On 2015-10-26 16:37, Francesco Mari wrote:
>>>
>>> 2015-10-26 13:15 GMT+01:00 Julian Reschke <ju...@gmx.de>:
>>>>
>>>> On 2015-10-26 12:13, Chetan Mehrotra wrote:
>>>>>
>>>>>
>>>>> Looking at history of oak-core/pom.xml  this change was done in [1]
>>>>> for OAK-1708 most like to support loading of various DB drivers from
>>>>> within Oak Core and probably a temp change which was not looked back
>>>>> again. That might not be required now as the DataSource gets injected
>>>>> and oak-core need not be aware of drivers etc. So we can get rid of
>>>>> that
>>>>>
>>>>> @Julian - Thoughts?
>>>>> ...
>>>>
>>>>
>>>>
>>>> No thoughts other than "I do not understand Maven dependencies
>>>> sufficiently
>>>> well to comment".
>>>>
>>>> How about changing it and see whether anything breaks?
>>>>
>>>
>>> It would be a good starting point if you would remember why the change
>>> was made in the first place, so we could have something more specific
>>> to look after.
>>
>>
>> I believe the change was made to avoid having dependencies such as to the
>> connection pool or specific JDBC drivers.
>>
>> But, again, if I knew/could remember I'd tell you. If you believe this is
>> incorrect just go ahead and fix it.
>>
>> Best regards, Julian

Re: Why does oak-core import every package with an optional resolution?

Posted by Francesco Mari <ma...@gmail.com>.
In the meantime, I logged OAK-3558.

2015-10-26 19:34 GMT+01:00 Julian Reschke <ju...@gmx.de>:
> On 2015-10-26 16:37, Francesco Mari wrote:
>>
>> 2015-10-26 13:15 GMT+01:00 Julian Reschke <ju...@gmx.de>:
>>>
>>> On 2015-10-26 12:13, Chetan Mehrotra wrote:
>>>>
>>>>
>>>> Looking at history of oak-core/pom.xml  this change was done in [1]
>>>> for OAK-1708 most like to support loading of various DB drivers from
>>>> within Oak Core and probably a temp change which was not looked back
>>>> again. That might not be required now as the DataSource gets injected
>>>> and oak-core need not be aware of drivers etc. So we can get rid of
>>>> that
>>>>
>>>> @Julian - Thoughts?
>>>> ...
>>>
>>>
>>>
>>> No thoughts other than "I do not understand Maven dependencies
>>> sufficiently
>>> well to comment".
>>>
>>> How about changing it and see whether anything breaks?
>>>
>>
>> It would be a good starting point if you would remember why the change
>> was made in the first place, so we could have something more specific
>> to look after.
>
>
> I believe the change was made to avoid having dependencies such as to the
> connection pool or specific JDBC drivers.
>
> But, again, if I knew/could remember I'd tell you. If you believe this is
> incorrect just go ahead and fix it.
>
> Best regards, Julian

Re: Why does oak-core import every package with an optional resolution?

Posted by Julian Reschke <ju...@gmx.de>.
On 2015-10-26 16:37, Francesco Mari wrote:
> 2015-10-26 13:15 GMT+01:00 Julian Reschke <ju...@gmx.de>:
>> On 2015-10-26 12:13, Chetan Mehrotra wrote:
>>>
>>> Looking at history of oak-core/pom.xml  this change was done in [1]
>>> for OAK-1708 most like to support loading of various DB drivers from
>>> within Oak Core and probably a temp change which was not looked back
>>> again. That might not be required now as the DataSource gets injected
>>> and oak-core need not be aware of drivers etc. So we can get rid of
>>> that
>>>
>>> @Julian - Thoughts?
>>> ...
>>
>>
>> No thoughts other than "I do not understand Maven dependencies sufficiently
>> well to comment".
>>
>> How about changing it and see whether anything breaks?
>>
>
> It would be a good starting point if you would remember why the change
> was made in the first place, so we could have something more specific
> to look after.

I believe the change was made to avoid having dependencies such as to 
the connection pool or specific JDBC drivers.

But, again, if I knew/could remember I'd tell you. If you believe this 
is incorrect just go ahead and fix it.

Best regards, Julian

Re: Why does oak-core import every package with an optional resolution?

Posted by Francesco Mari <ma...@gmail.com>.
2015-10-26 13:15 GMT+01:00 Julian Reschke <ju...@gmx.de>:
> On 2015-10-26 12:13, Chetan Mehrotra wrote:
>>
>> Looking at history of oak-core/pom.xml  this change was done in [1]
>> for OAK-1708 most like to support loading of various DB drivers from
>> within Oak Core and probably a temp change which was not looked back
>> again. That might not be required now as the DataSource gets injected
>> and oak-core need not be aware of drivers etc. So we can get rid of
>> that
>>
>> @Julian - Thoughts?
>> ...
>
>
> No thoughts other than "I do not understand Maven dependencies sufficiently
> well to comment".
>
> How about changing it and see whether anything breaks?
>

It would be a good starting point if you would remember why the change
was made in the first place, so we could have something more specific
to look after.

> Best regards, Julian

Re: Why does oak-core import every package with an optional resolution?

Posted by Julian Reschke <ju...@gmx.de>.
On 2015-10-26 12:13, Chetan Mehrotra wrote:
> Looking at history of oak-core/pom.xml  this change was done in [1]
> for OAK-1708 most like to support loading of various DB drivers from
> within Oak Core and probably a temp change which was not looked back
> again. That might not be required now as the DataSource gets injected
> and oak-core need not be aware of drivers etc. So we can get rid of
> that
>
> @Julian - Thoughts?
> ...

No thoughts other than "I do not understand Maven dependencies 
sufficiently well to comment".

How about changing it and see whether anything breaks?

Best regards, Julian

Re: Why does oak-core import every package with an optional resolution?

Posted by Chetan Mehrotra <ch...@gmail.com>.
Looking at history of oak-core/pom.xml  this change was done in [1]
for OAK-1708 most like to support loading of various DB drivers from
within Oak Core and probably a temp change which was not looked back
again. That might not be required now as the DataSource gets injected
and oak-core need not be aware of drivers etc. So we can get rid of
that

@Julian - Thoughts?


Chetan Mehrotra
[1] https://github.com/apache/jackrabbit-oak/commit/7f844d5cde52dc53c41cc01aad9079afb275438a


On Mon, Oct 26, 2015 at 4:20 PM, Francesco Mari
<ma...@gmail.com> wrote:
> A friendly reminder of this issue. Is there a specific reason why
> every dependency in oak-core has an optional resolution?
>
> 2015-10-22 15:34 GMT+02:00 Francesco Mari <ma...@gmail.com>:
>> Hi,
>>
>> can somebody explain me why oak-core has the "Import-Package"
>> directive set to "*;resolution:=optional"?
>>
>> The effect of this directive is that *every* imported package is
>> declared optional in the manifest file. Because of this, the OSGi
>> framework will always resolve the oak-core bundle, even if some of its
>> requirements are not satisfied. In particular, oak-core must always be
>> ready to cope with NoClassDefFoundExceptions.
>>
>> We should definitely fix this.

Re: Why does oak-core import every package with an optional resolution?

Posted by Francesco Mari <ma...@gmail.com>.
A friendly reminder of this issue. Is there a specific reason why
every dependency in oak-core has an optional resolution?

2015-10-22 15:34 GMT+02:00 Francesco Mari <ma...@gmail.com>:
> Hi,
>
> can somebody explain me why oak-core has the "Import-Package"
> directive set to "*;resolution:=optional"?
>
> The effect of this directive is that *every* imported package is
> declared optional in the manifest file. Because of this, the OSGi
> framework will always resolve the oak-core bundle, even if some of its
> requirements are not satisfied. In particular, oak-core must always be
> ready to cope with NoClassDefFoundExceptions.
>
> We should definitely fix this.