You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Brett Porter <br...@apache.org> on 2005/08/08 06:52:04 UTC
Re: optional dependencies was: [m2] POM inheritance
We've so far opted not to do this (basically an optional dependency) as
it can encourage poorly specified poms to stay that way. Basically by
saying this you are saying to those depending on you "you may need tis
jar at some point, but I can't tell you when". That's going to manifest
in a class cast exception. It really is a dependency, and instead we
allow the dependee to exclude the ones it knows it doesn't need.
This is more tedious though, and I'm not currently certain whether it is
better to allow optinoal dependencies to aid in this.
- Brett
Joerg Hohwiller wrote:
> Hi there,
>
> John Casey wrote:
>
> >try adding <inherit>true</inherit> to the plugin definition at the top
> >level...I can't remember whether the compiler plugin inherits by default
> >or not (my suspicions are "not").
>
>
> Not about POM inheritance but about dependency inheritance (transitive
> dependencies):
>
> Can I also put <inherit>false</inherit> to a dependency definition so it
> will not be inherited. E.g. if commons-logging does not want to carry
> out all of their supported implementations?
>
> Regards
> Jörg
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: optional dependencies was: [m2] POM inheritance
Posted by Brett Porter <br...@apache.org>.
Joerg Hohwiller wrote:
> 1. ugly maintainence of the project
> 2. a jar for each bridge-implementation
>
I'd hardly say it is ugly maintenance...
> But for 2. there should be a way to build a jar in the top-level project
> that includes all code-output compiled in the sub-projects.
> Is that making sense for you or is this already targeted by m2?
> Do you see a better solution?
This can definitely be done (the ant tasks repackage all the
dependencies into one jar).
As a commons logging user, I'd definitely prefer to be able to just take
the api and the implementation that goes with the loggin impl(s) I
intend to use.
>
> BTW. I have seen this issue for aggregated javadocs in maven1
> discussions a long
> time ago. Is that solved in m2?
Not yet, but it is filed and will be addressed in the near future.
- Brett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: optional dependencies was: [m2] POM inheritance
Posted by Joerg Hohwiller <jo...@j-hohwiller.de>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi there,
Joerg Hohwiller wrote:
> Hello Brett,
>
> Brett Porter wrote:
>
>>>We've so far opted not to do this (basically an optional dependency) as
>>>it can encourage poorly specified poms to stay that way. Basically by
>>>saying this you are saying to those depending on you "you may need tis
>>>jar at some point, but I can't tell you when". That's going to manifest
>>>in a class cast exception. It really is a dependency, and instead we
>>>allow the dependee to exclude the ones it knows it doesn't need.
>>>
>>>This is more tedious though, and I'm not currently certain whether it is
>>>better to allow optinoal dependencies to aid in this.
>
> Well if we make the example (commons-logging) more abstract we can think
> of a project providing a facade to some functionalitiy provided by
> various exisiting implementations (e.g. could also be a facade for GUI
> toolkits that allows Swing and SWT as backend).
> In that case you would have a more abstract dependency where one can
> choose. If that would be expressed in the POM as "dependency group"
> there could also be a default choice if not explicitly choosen by the
> aggregating project.
> But actually the more I think about, it may be the best and simplest
> approach to have a project just for the API and general code and a
> subproject for each backend implementation defining the dependencies to
> the real implementation. In the aggregating project you have a
> dependency on the API and choose the implementation by another dependency.
> So all I am saying is: you're right and maven(2) enforces structuring
> your projects, which is good :)
Actually I got totally lost in jarkarta-commons and othe projects before getting
into maven.
But now from the commons-logging point of view I want to raise this issue again:
If JCL would have the API as top-level project and a sub-project for each
bridge-implementation (log4j1.2, log4j1.3, jdk1.4-logger, logkit, avalon, etc.)
this would cause:
1. ugly maintainence of the project
2. a jar for each bridge-implementation
I think one could live with 1. Especially there is a general problem because
of the dependency on log4j in two different version - this forces to splitt off
in sub-projects if maven is used at all for the build.
But for 2. there should be a way to build a jar in the top-level project
that includes all code-output compiled in the sub-projects.
Is that making sense for you or is this already targeted by m2?
Do you see a better solution?
BTW. I have seen this issue for aggregated javadocs in maven1 discussions a long
time ago. Is that solved in m2?
> [cut]
Thanks
Jörg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDTDDXmPuec2Dcv/8RAhvNAJ9rHaZuCa+pduDOfZ5eE9sgG/mMIgCghJ5u
BWBIw970xrSMXMnetOQmJFg=
=EFwJ
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: optional dependencies was: [m2] POM inheritance
Posted by Joerg Hohwiller <jo...@j-hohwiller.de>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello Brett,
Brett Porter wrote:
> We've so far opted not to do this (basically an optional dependency) as
> it can encourage poorly specified poms to stay that way. Basically by
> saying this you are saying to those depending on you "you may need tis
> jar at some point, but I can't tell you when". That's going to manifest
> in a class cast exception. It really is a dependency, and instead we
> allow the dependee to exclude the ones it knows it doesn't need.
>
> This is more tedious though, and I'm not currently certain whether it is
> better to allow optinoal dependencies to aid in this.
Well if we make the example (commons-logging) more abstract we can think
of a project providing a facade to some functionalitiy provided by
various exisiting implementations (e.g. could also be a facade for GUI
toolkits that allows Swing and SWT as backend).
In that case you would have a more abstract dependency where one can
choose. If that would be expressed in the POM as "dependency group"
there could also be a default choice if not explicitly choosen by the
aggregating project.
But actually the more I think about, it may be the best and simplest
approach to have a project just for the API and general code and a
subproject for each backend implementation defining the dependencies to
the real implementation. In the aggregating project you have a
dependency on the API and choose the implementation by another dependency.
So all I am saying is: you're right and maven(2) enforces structuring
your projects, which is good :)
>
> - Brett
>
> Joerg Hohwiller wrote:
>
>
>>Hi there,
>>
>>John Casey wrote:
>>
>>
>>>try adding <inherit>true</inherit> to the plugin definition at the top
>>>level...I can't remember whether the compiler plugin inherits by default
>>>or not (my suspicions are "not").
>>
>>
>>Not about POM inheritance but about dependency inheritance (transitive
>>dependencies):
>>
>>Can I also put <inherit>false</inherit> to a dependency definition so it
>>will not be inherited. E.g. if commons-logging does not want to carry
>>out all of their supported implementations?
>>
>>Regards
>> Jörg
Thanks
Jörg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFC97EbmPuec2Dcv/8RAloPAKCVq41//SAgOqGakWlJ40TWP1jsFQCeOM7y
bgYSYkwBXeGPr9Jfv2PkeoE=
=bkou
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org