You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Felix Meschberger <fm...@gmail.com> on 2009/01/05 08:45:59 UTC
Dependency Management
Hi all,
Maven provides projects with a nice feature called dependency
management. In Sling we currently use this feature to declare the
non-Sling dependencies of modules in the parent POM.
After working with this some time and trying to upgrade various
dependencies I come to the conclusion, that using Maven dependency
management is not going to work out in our scenario.
Why ? Maven's Dependency Management is aimed at traditional
applicaitons, which are glued together statically during the build
process. For this environment, dependency management is a great thing,
since it guarantees a consistent application setup.
In a dynamic application setup as provided by an OSGi framework the
static dependency management of Maven does not help. Actually it even
causes problematic results with respect to backwards compatibility when
using the Maven Bundle plugin.
Why's that ? The Maven Bundle plugin is constructs the bundle manifest
and will generally automatically create the Import-Package header. If
the providing library (from maven's dependency list) has Export-Package
headers with version numbers, the Maven Bundle plugin will insert the
respective version numbers for Import-Package. This makes perfect sense,
because it is expected, that the artifact required at least the given
package version.
When using Maven Dependency Management, upgrading any dependencies in
the parent POM may automatically increse the version numbers in the
Import-Package headers and hence may cause any such bundle to fail
resolution if deployed - even though the bundle did not change and does
not really require a new version of the dependency.
So, in the case of OSGi deployment, Maven's Dependency Management
actually interferes with the OSGi framework dependency management.
As a consequence, I suggest we drop dependency management in the parent
pom (almost) completely and state, that
#1 each module must fully describe its dependencies
Some dependencies should probably be considered globally valid and will
still be available through dependency management:
JCR API (1.0)
Servlet API (2.4)
OSGi APIs (should generally be R4 based)
#2 each dependency version must be to the lowest possible number
This ensures that Import-Package version numbers will not increase
needlessly. Dependency version numbers should primarily be based on
API-functionality. Any higher version required due to bug-fixes in the
implementation is not an issue for a module to care about.
#3 keep dependency management for plugins (plugin management)
Plugin management is concerned with the build process only and it makes
perfect sense to keep this support and functionality.
Regards
Felix
Re: Dependency Management
Posted by Felix Meschberger <fm...@gmail.com>.
I have created https://issues.apache.org/jira/browse/SLING-811 to track
this.
Regards
Felix
Felix Meschberger schrieb:
> Hi all,
>
> Maven provides projects with a nice feature called dependency
> management. In Sling we currently use this feature to declare the
> non-Sling dependencies of modules in the parent POM.
>
> After working with this some time and trying to upgrade various
> dependencies I come to the conclusion, that using Maven dependency
> management is not going to work out in our scenario.
>
> Why ? Maven's Dependency Management is aimed at traditional
> applicaitons, which are glued together statically during the build
> process. For this environment, dependency management is a great thing,
> since it guarantees a consistent application setup.
>
> In a dynamic application setup as provided by an OSGi framework the
> static dependency management of Maven does not help. Actually it even
> causes problematic results with respect to backwards compatibility when
> using the Maven Bundle plugin.
>
> Why's that ? The Maven Bundle plugin is constructs the bundle manifest
> and will generally automatically create the Import-Package header. If
> the providing library (from maven's dependency list) has Export-Package
> headers with version numbers, the Maven Bundle plugin will insert the
> respective version numbers for Import-Package. This makes perfect sense,
> because it is expected, that the artifact required at least the given
> package version.
>
> When using Maven Dependency Management, upgrading any dependencies in
> the parent POM may automatically increse the version numbers in the
> Import-Package headers and hence may cause any such bundle to fail
> resolution if deployed - even though the bundle did not change and does
> not really require a new version of the dependency.
>
> So, in the case of OSGi deployment, Maven's Dependency Management
> actually interferes with the OSGi framework dependency management.
>
> As a consequence, I suggest we drop dependency management in the parent
> pom (almost) completely and state, that
>
>
> #1 each module must fully describe its dependencies
> Some dependencies should probably be considered globally valid and will
> still be available through dependency management:
> JCR API (1.0)
> Servlet API (2.4)
> OSGi APIs (should generally be R4 based)
>
>
> #2 each dependency version must be to the lowest possible number
> This ensures that Import-Package version numbers will not increase
> needlessly. Dependency version numbers should primarily be based on
> API-functionality. Any higher version required due to bug-fixes in the
> implementation is not an issue for a module to care about.
>
>
> #3 keep dependency management for plugins (plugin management)
> Plugin management is concerned with the build process only and it makes
> perfect sense to keep this support and functionality.
>
>
> Regards
> Felix
>
>
Re: Dependency Management
Posted by Felix Meschberger <fm...@gmail.com>.
Hi all,
I have created a documentation page "Dependency Management" about this
situation in the devlopment section of our site. This page should be
visible as soon as it is being synchronoized with the web server.
Regards
Felix
Felix Meschberger schrieb:
> Hi all,
>
> Maven provides projects with a nice feature called dependency
> management. In Sling we currently use this feature to declare the
> non-Sling dependencies of modules in the parent POM.
>
> After working with this some time and trying to upgrade various
> dependencies I come to the conclusion, that using Maven dependency
> management is not going to work out in our scenario.
>
> Why ? Maven's Dependency Management is aimed at traditional
> applicaitons, which are glued together statically during the build
> process. For this environment, dependency management is a great thing,
> since it guarantees a consistent application setup.
>
> In a dynamic application setup as provided by an OSGi framework the
> static dependency management of Maven does not help. Actually it even
> causes problematic results with respect to backwards compatibility when
> using the Maven Bundle plugin.
>
> Why's that ? The Maven Bundle plugin is constructs the bundle manifest
> and will generally automatically create the Import-Package header. If
> the providing library (from maven's dependency list) has Export-Package
> headers with version numbers, the Maven Bundle plugin will insert the
> respective version numbers for Import-Package. This makes perfect sense,
> because it is expected, that the artifact required at least the given
> package version.
>
> When using Maven Dependency Management, upgrading any dependencies in
> the parent POM may automatically increse the version numbers in the
> Import-Package headers and hence may cause any such bundle to fail
> resolution if deployed - even though the bundle did not change and does
> not really require a new version of the dependency.
>
> So, in the case of OSGi deployment, Maven's Dependency Management
> actually interferes with the OSGi framework dependency management.
>
> As a consequence, I suggest we drop dependency management in the parent
> pom (almost) completely and state, that
>
>
> #1 each module must fully describe its dependencies
> Some dependencies should probably be considered globally valid and will
> still be available through dependency management:
> JCR API (1.0)
> Servlet API (2.4)
> OSGi APIs (should generally be R4 based)
>
>
> #2 each dependency version must be to the lowest possible number
> This ensures that Import-Package version numbers will not increase
> needlessly. Dependency version numbers should primarily be based on
> API-functionality. Any higher version required due to bug-fixes in the
> implementation is not an issue for a module to care about.
>
>
> #3 keep dependency management for plugins (plugin management)
> Plugin management is concerned with the build process only and it makes
> perfect sense to keep this support and functionality.
>
>
> Regards
> Felix
>
>
Re: Dependency Management
Posted by Carsten Ziegeler <cz...@apache.org>.
Felix Meschberger wrote:
> #1 each module must fully describe its dependencies
> Some dependencies should probably be considered globally valid and will
> still be available through dependency management:
> JCR API (1.0)
> Servlet API (2.4)
> OSGi APIs (should generally be R4 based)
+1
> #2 each dependency version must be to the lowest possible number
> This ensures that Import-Package version numbers will not increase
> needlessly. Dependency version numbers should primarily be based on
> API-functionality. Any higher version required due to bug-fixes in the
> implementation is not an issue for a module to care about.
+1
> #3 keep dependency management for plugins (plugin management)
> Plugin management is concerned with the build process only and it makes
> perfect sense to keep this support and functionality.
+1
Carsten
--
Carsten Ziegeler
cziegeler@apache.org
Re: Dependency Management
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Felix,
On Mon, Jan 5, 2009 at 11:40 AM, Felix Meschberger <fm...@gmail.com> wrote:
> ...There may be some shades of gray, though: If the 1.1 versions is really
> that buggy, the bundle itself may of course request version 1.1.4, esp.
> if the operation of the bundle cannot be guaranteed with any version
> prior to 1.1.4.
>
> On the other hand: If the bundle would be fully and completely
> operational with 1.1 (even though it contains some bugs in some areas),
> the bundle should still just depend on 1.1....
Ok, so we seem to be in agreement here: a bundle should *in principle*
depend on the lowest version that it needs API-wise, but if it's
obvious that that version will not work, we'll bump the dependency
accordingly.
-Bertrand
Re: Dependency Management
Posted by Felix Meschberger <fm...@gmail.com>.
Hi,
Bertrand Delacretaz schrieb:
> Hi Felix,
>
> I agree with your proposals, with one slight concern:
>
> On Mon, Jan 5, 2009 at 8:45 AM, Felix Meschberger <fm...@gmail.com> wrote:
>> ...#2 each dependency version must be to the lowest possible number
>> This ensures that Import-Package version numbers will not increase
>> needlessly. Dependency version numbers should primarily be based on
>> API-functionality....
>
> Ok
>
>> ...Any higher version required due to bug-fixes in the
>> implementation is not an issue for a module to care about....
>
> In such a case, how and where do we express which actual version is required?
>
> If module A depends on V1.1 of library X at the API level, but V1.1 is
> buggy and we know that you really need 1.1.4 for things to work, where
> do people find out about that?
>
> "In the integration tests module" might be a valid answer, but I'd
> like to have your opinion on this.
Well, the black-and-white answer would really be "in the final packaging
build", be it launchpad/app, launchpad/webapp or even the actualy
deployment.
There may be some shades of gray, though: If the 1.1 versions is really
that buggy, the bundle itself may of course request version 1.1.4, esp.
if the operation of the bundle cannot be guaranteed with any version
prior to 1.1.4.
On the other hand: If the bundle would be fully and completely
operational with 1.1 (even though it contains some bugs in some areas),
the bundle should still just depend on 1.1.
Regards
Felix
Re: Dependency Management
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Felix,
I agree with your proposals, with one slight concern:
On Mon, Jan 5, 2009 at 8:45 AM, Felix Meschberger <fm...@gmail.com> wrote:
> ...#2 each dependency version must be to the lowest possible number
> This ensures that Import-Package version numbers will not increase
> needlessly. Dependency version numbers should primarily be based on
> API-functionality....
Ok
> ...Any higher version required due to bug-fixes in the
> implementation is not an issue for a module to care about....
In such a case, how and where do we express which actual version is required?
If module A depends on V1.1 of library X at the API level, but V1.1 is
buggy and we know that you really need 1.1.4 for things to work, where
do people find out about that?
"In the integration tests module" might be a valid answer, but I'd
like to have your opinion on this.
-Bertrand