You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by David Illsley <da...@gmail.com> on 2009/01/30 19:48:01 UTC

maven-bundle-plugin and Service-Component headers

Hi,
I'm trying to use the maven-bundle-plugin to generate a manifest and
service component files (plugin def below), however I only get the
Manifest.MF file generated with pointers to service component files
which don't exist e.g. Service-Component:
OSGI-INF/org.apache.axiom.injection.FactoryInjectionComponent.xml

I was wondering if you'd expect this to work, and what I need to do to
debug it or get it to work, or if this is a bug I should raise?

Thanks,
David

			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>1.5.0-SNAPSHOT</version>
				<executions>
					<execution>
						<id>bundle-manifest</id>
						<phase>process-classes</phase>
						<goals>
							<goal>manifest</goal>
						</goals>
						        <configuration>
          <instructions>
            <Service-Component>org.apache.axiom.injection.FactoryInjectionComponent</Service-Component>
          </instructions>
        </configuration>
					</execution>
				</executions>
			</plugin>

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


Re: maven-bundle-plugin and Service-Component headers

Posted by Stuart McCulloch <mc...@gmail.com>.
2009/2/3 David Illsley <da...@gmail.com>

> Thanks, both of those answers are really useful. I'm thinking that
> changing to bundle packaging is the right move, but the way the docs
> are written implies there's a downside to doing so. Is there, and is
> there a doc somewhere explaining the tradeoffs?


the only "downside" is that you often need to be more specific
over what packages you want to export / import / keep private

this is because the Bnd Tool (http://www.aqute.biz/Code/Bnd)
pulls classes & resources into the bundle based on instructions
whereas the jar plugin just zips up whatever is in target/classes

but that's a key point of OSGi - you describe what your bundle
needs and provides, so that users aren't faced with an opaque
jar that they then cobble together with other jars in a faint hope
that it will all work together ;)

so you incur a little pain now, to help users / deployers later on

the main docs should describe what you need to do:

   http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
   [ http://felix.apache.org/site/apache-felix-maven-scr-plugin.html ]

yell if there's anything obvious missing...

the next upcoming release of the bundleplugin aims to make it
much easier to change packaging (perhaps almost seamless)
but this won't be available for at least a few weeks.

Cheers,
> David
>
> On Sat, Jan 31, 2009 at 10:07 AM, João Assunção <jo...@joaoassuncao.com>
> wrote:
> > I use the Maven SCR Plugin
> > (http://felix.apache.org/site/apache-felix-maven-scr-plugin.html) for
> > that task.
> > Just define the scr descriptor using javadoc tags and the plugin will
> > do the rest.
> >
> >
> > On Sat, Jan 31, 2009 at 4:17 AM, Stuart McCulloch <mc...@gmail.com>
> wrote:
> >> 2009/1/31 David Illsley <da...@gmail.com>
> >>
> >>> Hi,
> >>> I'm trying to use the maven-bundle-plugin to generate a manifest and
> >>> service component files (plugin def below), however I only get the
> >>> Manifest.MF file generated with pointers to service component files
> >>> which don't exist e.g. Service-Component:
> >>> OSGI-INF/org.apache.axiom.injection.FactoryInjectionComponent.xml
> >>>
> >>> I was wondering if you'd expect this to work, and what I need to do to
> >>> debug it or get it to work, or if this is a bug I should raise?
> >>>
> >>
> >> the manifest goal (by definition) will only generate a manifest file,
> >> it does not change anything else in target/classes or alter the jar
> >> (which I assume is created by the maven-war-plugin)
> >>
> >> if you want to use something like Service-Component, which will
> >> create files in the bundle as well as the manifest, and you want to
> >> keep using the manifest goal, then you'll need to supply those files
> >> yourself
> >>
> >> alternatively you could use the "bundle" goal instead of "manifest"
> >> - you could then unpack the bits you need if you still wanted to use
> >> another packaging like "jar" / "war"
> >>
> >> even better would be to switch over to use "bundle" packaging in
> >> your pom, then you wouldn't need the extra execution at all
> >>
> >>
> >>> Thanks,
> >>> David
> >>>
> >>>                        <plugin>
> >>>                                <groupId>org.apache.felix</groupId>
> >>>
>  <artifactId>maven-bundle-plugin</artifactId>
> >>>                                <version>1.5.0-SNAPSHOT</version>
> >>>                                <executions>
> >>>                                        <execution>
> >>>                                                <id>bundle-manifest</id>
> >>>
> >>>  <phase>process-classes</phase>
> >>>                                                <goals>
> >>>
> >>>  <goal>manifest</goal>
> >>>                                                </goals>
> >>>                                                        <configuration>
> >>>          <instructions>
> >>>
> >>>
>  <Service-Component>org.apache.axiom.injection.FactoryInjectionComponent</Service-Component>
> >>>          </instructions>
> >>>        </configuration>
> >>>                                        </execution>
> >>>                                </executions>
> >>>                        </plugin>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >>> For additional commands, e-mail: users-help@felix.apache.org
> >>>
> >>>
> >> --
> >> Cheers, Stuart
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> 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 and Service-Component headers

Posted by David Illsley <da...@gmail.com>.
Thanks, both of those answers are really useful. I'm thinking that
changing to bundle packaging is the right move, but the way the docs
are written implies there's a downside to doing so. Is there, and is
there a doc somewhere explaining the tradeoffs?
Cheers,
David

On Sat, Jan 31, 2009 at 10:07 AM, João Assunção <jo...@joaoassuncao.com> wrote:
> I use the Maven SCR Plugin
> (http://felix.apache.org/site/apache-felix-maven-scr-plugin.html) for
> that task.
> Just define the scr descriptor using javadoc tags and the plugin will
> do the rest.
>
>
> On Sat, Jan 31, 2009 at 4:17 AM, Stuart McCulloch <mc...@gmail.com> wrote:
>> 2009/1/31 David Illsley <da...@gmail.com>
>>
>>> Hi,
>>> I'm trying to use the maven-bundle-plugin to generate a manifest and
>>> service component files (plugin def below), however I only get the
>>> Manifest.MF file generated with pointers to service component files
>>> which don't exist e.g. Service-Component:
>>> OSGI-INF/org.apache.axiom.injection.FactoryInjectionComponent.xml
>>>
>>> I was wondering if you'd expect this to work, and what I need to do to
>>> debug it or get it to work, or if this is a bug I should raise?
>>>
>>
>> the manifest goal (by definition) will only generate a manifest file,
>> it does not change anything else in target/classes or alter the jar
>> (which I assume is created by the maven-war-plugin)
>>
>> if you want to use something like Service-Component, which will
>> create files in the bundle as well as the manifest, and you want to
>> keep using the manifest goal, then you'll need to supply those files
>> yourself
>>
>> alternatively you could use the "bundle" goal instead of "manifest"
>> - you could then unpack the bits you need if you still wanted to use
>> another packaging like "jar" / "war"
>>
>> even better would be to switch over to use "bundle" packaging in
>> your pom, then you wouldn't need the extra execution at all
>>
>>
>>> Thanks,
>>> David
>>>
>>>                        <plugin>
>>>                                <groupId>org.apache.felix</groupId>
>>>                                <artifactId>maven-bundle-plugin</artifactId>
>>>                                <version>1.5.0-SNAPSHOT</version>
>>>                                <executions>
>>>                                        <execution>
>>>                                                <id>bundle-manifest</id>
>>>
>>>  <phase>process-classes</phase>
>>>                                                <goals>
>>>
>>>  <goal>manifest</goal>
>>>                                                </goals>
>>>                                                        <configuration>
>>>          <instructions>
>>>
>>>  <Service-Component>org.apache.axiom.injection.FactoryInjectionComponent</Service-Component>
>>>          </instructions>
>>>        </configuration>
>>>                                        </execution>
>>>                                </executions>
>>>                        </plugin>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>> --
>> Cheers, Stuart
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

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


Re: maven-bundle-plugin and Service-Component headers

Posted by João Assunção <jo...@joaoassuncao.com>.
I use the Maven SCR Plugin
(http://felix.apache.org/site/apache-felix-maven-scr-plugin.html) for
that task.
Just define the scr descriptor using javadoc tags and the plugin will
do the rest.


On Sat, Jan 31, 2009 at 4:17 AM, Stuart McCulloch <mc...@gmail.com> wrote:
> 2009/1/31 David Illsley <da...@gmail.com>
>
>> Hi,
>> I'm trying to use the maven-bundle-plugin to generate a manifest and
>> service component files (plugin def below), however I only get the
>> Manifest.MF file generated with pointers to service component files
>> which don't exist e.g. Service-Component:
>> OSGI-INF/org.apache.axiom.injection.FactoryInjectionComponent.xml
>>
>> I was wondering if you'd expect this to work, and what I need to do to
>> debug it or get it to work, or if this is a bug I should raise?
>>
>
> the manifest goal (by definition) will only generate a manifest file,
> it does not change anything else in target/classes or alter the jar
> (which I assume is created by the maven-war-plugin)
>
> if you want to use something like Service-Component, which will
> create files in the bundle as well as the manifest, and you want to
> keep using the manifest goal, then you'll need to supply those files
> yourself
>
> alternatively you could use the "bundle" goal instead of "manifest"
> - you could then unpack the bits you need if you still wanted to use
> another packaging like "jar" / "war"
>
> even better would be to switch over to use "bundle" packaging in
> your pom, then you wouldn't need the extra execution at all
>
>
>> Thanks,
>> David
>>
>>                        <plugin>
>>                                <groupId>org.apache.felix</groupId>
>>                                <artifactId>maven-bundle-plugin</artifactId>
>>                                <version>1.5.0-SNAPSHOT</version>
>>                                <executions>
>>                                        <execution>
>>                                                <id>bundle-manifest</id>
>>
>>  <phase>process-classes</phase>
>>                                                <goals>
>>
>>  <goal>manifest</goal>
>>                                                </goals>
>>                                                        <configuration>
>>          <instructions>
>>
>>  <Service-Component>org.apache.axiom.injection.FactoryInjectionComponent</Service-Component>
>>          </instructions>
>>        </configuration>
>>                                        </execution>
>>                                </executions>
>>                        </plugin>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
> --
> 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 and Service-Component headers

Posted by Stuart McCulloch <mc...@gmail.com>.
2009/1/31 David Illsley <da...@gmail.com>

> Hi,
> I'm trying to use the maven-bundle-plugin to generate a manifest and
> service component files (plugin def below), however I only get the
> Manifest.MF file generated with pointers to service component files
> which don't exist e.g. Service-Component:
> OSGI-INF/org.apache.axiom.injection.FactoryInjectionComponent.xml
>
> I was wondering if you'd expect this to work, and what I need to do to
> debug it or get it to work, or if this is a bug I should raise?
>

the manifest goal (by definition) will only generate a manifest file,
it does not change anything else in target/classes or alter the jar
(which I assume is created by the maven-war-plugin)

if you want to use something like Service-Component, which will
create files in the bundle as well as the manifest, and you want to
keep using the manifest goal, then you'll need to supply those files
yourself

alternatively you could use the "bundle" goal instead of "manifest"
- you could then unpack the bits you need if you still wanted to use
another packaging like "jar" / "war"

even better would be to switch over to use "bundle" packaging in
your pom, then you wouldn't need the extra execution at all


> Thanks,
> David
>
>                        <plugin>
>                                <groupId>org.apache.felix</groupId>
>                                <artifactId>maven-bundle-plugin</artifactId>
>                                <version>1.5.0-SNAPSHOT</version>
>                                <executions>
>                                        <execution>
>                                                <id>bundle-manifest</id>
>
>  <phase>process-classes</phase>
>                                                <goals>
>
>  <goal>manifest</goal>
>                                                </goals>
>                                                        <configuration>
>          <instructions>
>
>  <Service-Component>org.apache.axiom.injection.FactoryInjectionComponent</Service-Component>
>          </instructions>
>        </configuration>
>                                        </execution>
>                                </executions>
>                        </plugin>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
-- 
Cheers, Stuart