You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by de...@gmail.com on 2009/01/27 14:40:51 UTC

Maven bundle plugin: Is it possible to mark optional Maven dependencies to be imported with resolition=optional

Hi guys,
   I'm walking my first steps in Maven bundle plugin, and I can say it has
been really helpful for now.
However, I seem to be missing how (if possible at all) can I instruct it to
mark the dependencies marked as "optional" in Maven to be imported with the
"resolution=optional".
My understanding so far is that these do not get processed by Maven Bundle
plugin, but are resolved by BND by looking at the imports, which are not on
the classpath, is this correct?
The project that I'm trying to bundle is built on top of Axis2 and has a lot
of optional dependencies (let's say tens of), I do not even know about all
of them because they did not
go into the standard distribution. But now it seems that BND finds the
references to them and assumes them to be mandatory adding a bunch of
imports in the manifest.

These are really a lot, e.g. about 240 packages and all of them are not
actually required by the application unless the users explicitly enable a
certain feature.
So is there a way I can mark all the optionals as optional in the manifest,
without having to do it manually for each package?

Kind Regards,
    Detelin

Re: Maven bundle plugin: Is it possible to mark optional Maven dependencies to be imported with resolition=optional

Posted by Stuart McCulloch <mc...@gmail.com>.
2009/2/23 Juhos, Pavol <pj...@hp.com>

> Hi,
>
> I've encountered the same issue as Detelin. See the corresponding JIRA
> issue -- https://issues.apache.org/jira/browse/FELIX-954
>

thanks I've updated it with some comments - btw, if you have an example POM
that you can share which creates a bundle with hundreds of imports please
attach it to this issue. Even just seeing the Bnd instructions for such an
example would be useful as we might be able to help you reduce the imports
by using existing instructions without making it too much of a manual
process.

Cheers,
> --
> PJ
>
> ________________________________________
> From: Stuart McCulloch [mcculls@gmail.com]
> Sent: Wednesday, January 28, 2009 3:04 PM
> To: users@felix.apache.org
> Subject: Re: Maven bundle plugin: Is it possible to mark optional Maven
>     dependencies to be imported with resolition=optional
>
> 2009/1/28 <de...@gmail.com>
>
> > Hi guys,
> >   What about the following proposal:
> > 1. when the bundle plugin is building the classpath, for each artifact
> that
> > is marked as "optional" in the pom, it builds a list of all packages
> inside
> > the artifact jar and adds a corresponding import-package instructions
> with
> > the resolution = optional
> > 2. if an import instruction is already present it should not be
> > overwritten,
> > since users may want to override this behavior
> > 3. when the build plugin is building the imports it will merge the
> referred
> > packages with the import instructions, thus augmenting it with any
> > resolution=optional attributes that may have been added in step 1
> >
> > What do you think?
> >
>
> yes, this might be possible - I've already been thinking about generating
> better
> defaults for the Export-Package/Private-Package settings based on analyzing
> the actual packages in "target/classes", and this would need very similar
> code
>
> can you open a JIRA feature request for this?
>
>
> > On Tue, Jan 27, 2009 at 3:40 PM, <de...@gmail.com> wrote:
> >
> > > Hi guys,
> > >    I'm walking my first steps in Maven bundle plugin, and I can say it
> > has
> > > been really helpful for now.
> > > However, I seem to be missing how (if possible at all) can I instruct
> it
> > to
> > > mark the dependencies marked as "optional" in Maven to be imported with
> > the
> > > "resolution=optional".
> > > My understanding so far is that these do not get processed by Maven
> > Bundle
> > > plugin, but are resolved by BND by looking at the imports, which are
> not
> > on
> > > the classpath, is this correct?
> > > The project that I'm trying to bundle is built on top of Axis2 and has
> a
> > > lot of optional dependencies (let's say tens of), I do not even know
> > about
> > > all of them because they did not
> > > go into the standard distribution. But now it seems that BND finds the
> > > references to them and assumes them to be mandatory adding a bunch of
> > > imports in the manifest.
> > >
> > > These are really a lot, e.g. about 240 packages and all of them are not
> > > actually required by the application unless the users explicitly enable
> a
> > > certain feature.
> > > So is there a way I can mark all the optionals as optional in the
> > manifest,
> > > without having to do it manually for each package?
> > >
> > > Kind Regards,
> > >     Detelin
> > >
> >
>
>
>
> --
> Cheers, Stuart
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Cheers, Stuart

RE: Maven bundle plugin: Is it possible to mark optional Maven dependencies to be imported with resolition=optional

Posted by "Juhos, Pavol" <pj...@hp.com>.
Hi,

I've encountered the same issue as Detelin. See the corresponding JIRA issue -- https://issues.apache.org/jira/browse/FELIX-954

Cheers,
-- 
PJ

________________________________________
From: Stuart McCulloch [mcculls@gmail.com]
Sent: Wednesday, January 28, 2009 3:04 PM
To: users@felix.apache.org
Subject: Re: Maven bundle plugin: Is it possible to mark optional Maven         dependencies to be imported with resolition=optional

2009/1/28 <de...@gmail.com>

> Hi guys,
>   What about the following proposal:
> 1. when the bundle plugin is building the classpath, for each artifact that
> is marked as "optional" in the pom, it builds a list of all packages inside
> the artifact jar and adds a corresponding import-package instructions with
> the resolution = optional
> 2. if an import instruction is already present it should not be
> overwritten,
> since users may want to override this behavior
> 3. when the build plugin is building the imports it will merge the referred
> packages with the import instructions, thus augmenting it with any
> resolution=optional attributes that may have been added in step 1
>
> What do you think?
>

yes, this might be possible - I've already been thinking about generating
better
defaults for the Export-Package/Private-Package settings based on analyzing
the actual packages in "target/classes", and this would need very similar
code

can you open a JIRA feature request for this?


> On Tue, Jan 27, 2009 at 3:40 PM, <de...@gmail.com> wrote:
>
> > Hi guys,
> >    I'm walking my first steps in Maven bundle plugin, and I can say it
> has
> > been really helpful for now.
> > However, I seem to be missing how (if possible at all) can I instruct it
> to
> > mark the dependencies marked as "optional" in Maven to be imported with
> the
> > "resolution=optional".
> > My understanding so far is that these do not get processed by Maven
> Bundle
> > plugin, but are resolved by BND by looking at the imports, which are not
> on
> > the classpath, is this correct?
> > The project that I'm trying to bundle is built on top of Axis2 and has a
> > lot of optional dependencies (let's say tens of), I do not even know
> about
> > all of them because they did not
> > go into the standard distribution. But now it seems that BND finds the
> > references to them and assumes them to be mandatory adding a bunch of
> > imports in the manifest.
> >
> > These are really a lot, e.g. about 240 packages and all of them are not
> > actually required by the application unless the users explicitly enable a
> > certain feature.
> > So is there a way I can mark all the optionals as optional in the
> manifest,
> > without having to do it manually for each package?
> >
> > Kind Regards,
> >     Detelin
> >
>



--
Cheers, Stuart
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Maven bundle plugin: Is it possible to mark optional Maven dependencies to be imported with resolition=optional

Posted by Stuart McCulloch <mc...@gmail.com>.
2009/1/28 <de...@gmail.com>

> Hi guys,
>   What about the following proposal:
> 1. when the bundle plugin is building the classpath, for each artifact that
> is marked as "optional" in the pom, it builds a list of all packages inside
> the artifact jar and adds a corresponding import-package instructions with
> the resolution = optional
> 2. if an import instruction is already present it should not be
> overwritten,
> since users may want to override this behavior
> 3. when the build plugin is building the imports it will merge the referred
> packages with the import instructions, thus augmenting it with any
> resolution=optional attributes that may have been added in step 1
>
> What do you think?
>

yes, this might be possible - I've already been thinking about generating
better
defaults for the Export-Package/Private-Package settings based on analyzing
the actual packages in "target/classes", and this would need very similar
code

can you open a JIRA feature request for this?


> On Tue, Jan 27, 2009 at 3:40 PM, <de...@gmail.com> wrote:
>
> > Hi guys,
> >    I'm walking my first steps in Maven bundle plugin, and I can say it
> has
> > been really helpful for now.
> > However, I seem to be missing how (if possible at all) can I instruct it
> to
> > mark the dependencies marked as "optional" in Maven to be imported with
> the
> > "resolution=optional".
> > My understanding so far is that these do not get processed by Maven
> Bundle
> > plugin, but are resolved by BND by looking at the imports, which are not
> on
> > the classpath, is this correct?
> > The project that I'm trying to bundle is built on top of Axis2 and has a
> > lot of optional dependencies (let's say tens of), I do not even know
> about
> > all of them because they did not
> > go into the standard distribution. But now it seems that BND finds the
> > references to them and assumes them to be mandatory adding a bunch of
> > imports in the manifest.
> >
> > These are really a lot, e.g. about 240 packages and all of them are not
> > actually required by the application unless the users explicitly enable a
> > certain feature.
> > So is there a way I can mark all the optionals as optional in the
> manifest,
> > without having to do it manually for each package?
> >
> > Kind Regards,
> >     Detelin
> >
>



-- 
Cheers, Stuart

Re: Maven bundle plugin: Is it possible to mark optional Maven dependencies to be imported with resolition=optional

Posted by de...@gmail.com.
Hi guys,
   What about the following proposal:
1. when the bundle plugin is building the classpath, for each artifact that
is marked as "optional" in the pom, it builds a list of all packages inside
the artifact jar and adds a corresponding import-package instructions with
the resolution = optional
2. if an import instruction is already present it should not be overwritten,
since users may want to override this behavior
3. when the build plugin is building the imports it will merge the referred
packages with the import instructions, thus augmenting it with any
resolution=optional attributes that may have been added in step 1

What do you think?


On Tue, Jan 27, 2009 at 3:40 PM, <de...@gmail.com> wrote:

> Hi guys,
>    I'm walking my first steps in Maven bundle plugin, and I can say it has
> been really helpful for now.
> However, I seem to be missing how (if possible at all) can I instruct it to
> mark the dependencies marked as "optional" in Maven to be imported with the
> "resolution=optional".
> My understanding so far is that these do not get processed by Maven Bundle
> plugin, but are resolved by BND by looking at the imports, which are not on
> the classpath, is this correct?
> The project that I'm trying to bundle is built on top of Axis2 and has a
> lot of optional dependencies (let's say tens of), I do not even know about
> all of them because they did not
> go into the standard distribution. But now it seems that BND finds the
> references to them and assumes them to be mandatory adding a bunch of
> imports in the manifest.
>
> These are really a lot, e.g. about 240 packages and all of them are not
> actually required by the application unless the users explicitly enable a
> certain feature.
> So is there a way I can mark all the optionals as optional in the manifest,
> without having to do it manually for each package?
>
> Kind Regards,
>     Detelin
>