[fedora-java] Weak dependencies

Mikolaj Izdebski mizdebsk at redhat.com
Tue Apr 1 12:14:16 UTC 2014


On 04/01/2014 01:46 PM, Jiri Vanek wrote:
> On 04/01/2014 01:28 PM, Mikolaj Izdebski wrote:
>> Fedora 21 will likely introduce so called "weak" or "soft" dependencies,
>> also known as recommends and suggests.  For proposed change see [1].
>> What do you think about Java packages adopting usage of weak
>> dependencies?
>>
>> An example: Dependencies declared as optional in POM files could be
>> translated by dependency generators to Recommends instead of Requires.
>>
>> Any thoughts on this?
>>
>> [1] https://fedoraproject.org/wiki/Changes/RPM-4.12
>>
> 
> There is always issue that end users will hardly know why, should he
> install something and mostly there is no nice dialogue "This feature
> works only when you download also .....(and put it on classapth)" Not
> mentioning that upstreams do not care about "to enable this feature yum
> install someRpm"
> 
> Well I have (me-touching) example in mind. IcedTea-Web have "weak"
> dependence on tagsoup. Well it works without it, but then some JNLP
> files are not parsed. User get jsut "invalid xml" exception in this
> case. So he will have no clue, that he should install tagsoup,
> 
> Will there be any mechanism for this? I doubt:(
> 
> TBH - I can come only with one good usage - to use soft dependence
> *only* for dependence which are not in fedora. Once it is packed, lets
> it be installed all.

I don't think what you described here is the behaviour of Recommends.

If package A recommends B then by installing A you also install B,
unless something conflicts with it or obsoletes it.  After installing A
you can erase B without breaking dependencies.

Example.  Lets assume we have package maven with:
  Requires:   java-headless
  Recommends: java-devel
  Suggests:   maven-doc

When you do "yum install maven", YUM should print something like:

Installing: maven
Installing for dependencies: java-1.8.0-openjdk-headless
Installing recommended dependencies: java-1.8.0-openjdk-devel
You may also consider installing: maven-doc

Maven obviously cannot run without java-headless, so hard requirement is
used here.

Maven is usually used to compile Java sources, hence Recommends on
java-devel.  But Maven itself works perfectly fine without java-devel,
so users can erase java-devel after installing maven, if they want to.
java-devel is a dependency that most users would expect, so it is
"recommends".

maven-doc is just added as suggestion and it will not be pulled by yum
with default settings.  It's added there just to point users to other
useful resources.

-- 
Mikolaj Izdebski
Software Engineer, Red Hat
IRC: mizdebsk


More information about the java-devel mailing list