[VOTE] Optional dependencies and Maven

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[VOTE] Optional dependencies and Maven

Thomas Mortagne
Administrator
Hi devs,

So we now have the concept of optional dependencies at Extension
Manager level. This are dependencies that are installed by default
(but if they fail they don't fail the whole install) and which can be
uninstalled without any impact on what is no longer it's backward
dependency.

On Maven -> EM side what I did is reuse <optional>true</optional>
mostly the following reason: there is no way in pom.xml to put custom
stuff in <dependency> so it would be a huge pain to maintain a list of
optional dependencies from a property at general pom level.

The issue is that the behavior of this <optional> is not exactly the
same in EM and Maven: in Maven those dependencies are NOT triggered by
default. Still, apart from this it's supposed to be the same meaning
and it should not be an issue to install this dependency (if it is
then it means you should have used something else like
<scope>provided</scope>) but as usually since there is no official way
in Maven to say "I just want to use that during the build and it does
not make any sens to get this dependency" some projects may have used
it that way.

So do you think it is OK ? It's not acceptable and we absolutely need
to move this kind of information in some general property in the pom
<properties> ?

--
Thomas Mortagne
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [VOTE] Optional dependencies and Maven

Ecaterina Moraru (Valica)
Can we make <optional>true</optional> by default?

Or what I mean can we have instead a <mandatory>true</mandatory> instead of
<optional>?

I fear that devs will forget to put <optional>. Again this matters for
builds that group modules as dependencies, although are not really needed.

On Wed, Jul 5, 2017 at 6:17 PM, Thomas Mortagne <[hidden email]>
wrote:

> Hi devs,
>
> So we now have the concept of optional dependencies at Extension
> Manager level. This are dependencies that are installed by default
> (but if they fail they don't fail the whole install) and which can be
> uninstalled without any impact on what is no longer it's backward
> dependency.
>
> On Maven -> EM side what I did is reuse <optional>true</optional>
> mostly the following reason: there is no way in pom.xml to put custom
> stuff in <dependency> so it would be a huge pain to maintain a list of
> optional dependencies from a property at general pom level.
>
> The issue is that the behavior of this <optional> is not exactly the
> same in EM and Maven: in Maven those dependencies are NOT triggered by
> default. Still, apart from this it's supposed to be the same meaning
> and it should not be an issue to install this dependency (if it is
> then it means you should have used something else like
> <scope>provided</scope>) but as usually since there is no official way
> in Maven to say "I just want to use that during the build and it does
> not make any sens to get this dependency" some projects may have used
> it that way.
>
> So do you think it is OK ? It's not acceptable and we absolutely need
> to move this kind of information in some general property in the pom
> <properties> ?
>
> --
> Thomas Mortagne
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [VOTE] Optional dependencies and Maven

Thomas Mortagne
Administrator
On Wed, Jul 5, 2017 at 5:41 PM, Ecaterina Moraru (Valica)
<[hidden email]> wrote:
> Can we make <optional>true</optional> by default?
>
> Or what I mean can we have instead a <mandatory>true</mandatory> instead of
> <optional>?

That would be a very bad idea. In most cases (flavor are really not
most cases) you require the dependencies you indicated.

>
> I fear that devs will forget to put <optional>. Again this matters for
> builds that group modules as dependencies, although are not really needed.
>
> On Wed, Jul 5, 2017 at 6:17 PM, Thomas Mortagne <[hidden email]>
> wrote:
>
>> Hi devs,
>>
>> So we now have the concept of optional dependencies at Extension
>> Manager level. This are dependencies that are installed by default
>> (but if they fail they don't fail the whole install) and which can be
>> uninstalled without any impact on what is no longer it's backward
>> dependency.
>>
>> On Maven -> EM side what I did is reuse <optional>true</optional>
>> mostly the following reason: there is no way in pom.xml to put custom
>> stuff in <dependency> so it would be a huge pain to maintain a list of
>> optional dependencies from a property at general pom level.
>>
>> The issue is that the behavior of this <optional> is not exactly the
>> same in EM and Maven: in Maven those dependencies are NOT triggered by
>> default. Still, apart from this it's supposed to be the same meaning
>> and it should not be an issue to install this dependency (if it is
>> then it means you should have used something else like
>> <scope>provided</scope>) but as usually since there is no official way
>> in Maven to say "I just want to use that during the build and it does
>> not make any sens to get this dependency" some projects may have used
>> it that way.
>>
>> So do you think it is OK ? It's not acceptable and we absolutely need
>> to move this kind of information in some general property in the pom
>> <properties> ?
>>
>> --
>> Thomas Mortagne
>>



--
Thomas Mortagne
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [VOTE] Optional dependencies and Maven

vmassol
Administrator
In reply to this post by Thomas Mortagne
Hi,

> On 5 Jul 2017, at 17:17, Thomas Mortagne <[hidden email]> wrote:
>
> Hi devs,
>
> So we now have the concept of optional dependencies at Extension
> Manager level. This are dependencies that are installed by default
> (but if they fail they don't fail the whole install) and which can be
> uninstalled without any impact on what is no longer it's backward
> dependency.
>
> On Maven -> EM side what I did is reuse <optional>true</optional>
> mostly the following reason: there is no way in pom.xml to put custom
> stuff in <dependency> so it would be a huge pain to maintain a list of
> optional dependencies from a property at general pom level.
>
> The issue is that the behavior of this <optional> is not exactly the
> same in EM and Maven: in Maven those dependencies are NOT triggered by
> default. Still, apart from this it's supposed to be the same meaning
> and it should not be an issue to install this dependency (if it is
> then it means you should have used something else like
> <scope>provided</scope>) but as usually since there is no official way
> in Maven to say "I just want to use that during the build and it does
> not make any sens to get this dependency" some projects may have used
> it that way.
>
> So do you think it is OK ? It's not acceptable and we absolutely need
> to move this kind of information in some general property in the pom
> <properties> ?

I don’t really know. I hope it’s fine. We already have usages of the maven optional keyword in our POMs; will it work for those use cases? (haven’t checked but AFAIR it should work the same since we used those for optional deps in XAR modules but probably needs a closer look).

Thanks
-Vincent

>
> --
> Thomas Mortagne

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [VOTE] Optional dependencies and Maven

Thomas Mortagne
Administrator
On Thu, Jul 6, 2017 at 11:07 AM, Vincent Massol <[hidden email]> wrote:

> Hi,
>
>> On 5 Jul 2017, at 17:17, Thomas Mortagne <[hidden email]> wrote:
>>
>> Hi devs,
>>
>> So we now have the concept of optional dependencies at Extension
>> Manager level. This are dependencies that are installed by default
>> (but if they fail they don't fail the whole install) and which can be
>> uninstalled without any impact on what is no longer it's backward
>> dependency.
>>
>> On Maven -> EM side what I did is reuse <optional>true</optional>
>> mostly the following reason: there is no way in pom.xml to put custom
>> stuff in <dependency> so it would be a huge pain to maintain a list of
>> optional dependencies from a property at general pom level.
>>
>> The issue is that the behavior of this <optional> is not exactly the
>> same in EM and Maven: in Maven those dependencies are NOT triggered by
>> default. Still, apart from this it's supposed to be the same meaning
>> and it should not be an issue to install this dependency (if it is
>> then it means you should have used something else like
>> <scope>provided</scope>) but as usually since there is no official way
>> in Maven to say "I just want to use that during the build and it does
>> not make any sens to get this dependency" some projects may have used
>> it that way.
>>
>> So do you think it is OK ? It's not acceptable and we absolutely need
>> to move this kind of information in some general property in the pom
>> <properties> ?
>
> I don’t really know. I hope it’s fine. We already have usages of the maven optional keyword in our POMs; will it work for those use cases? (haven’t checked but AFAIR it should work the same since we used those for optional deps in XAR modules but probably needs a closer look).

I'm not really worried about our stuff, if we are using <optional>
wrongly (i.e. for forbidden stuff and not optional stuff) I will fix
them.

>
> Thanks
> -Vincent
>
>>
>> --
>> Thomas Mortagne
>



--
Thomas Mortagne
Loading...