You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Rickard Öberg <ri...@gmail.com> on 2010/07/09 06:19:47 UTC

Maven BND plugin and building WAR files with dependencies

Hi,

I'm using the Maven BND plugin to generate the manifest for a WAR file 
that contains embedded dependencies. I have tried to follow all the 
guidelines out there (OPS4J+Apache websites), but without luck.

The main problem seems to be that the plugin cannot recognize where the 
embedded dependencies are. My POM BND instructions look like this:
<Export-Package>
     ... exported packages *from embedded dependencies* goes here...
     ... exported packages from WAR project goes here ...
</Export-Package>

<Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath>

<Embed-Directory>WEB-INF/lib/</Embed-Directory>
... more instructions ...

When I run Maven on this it generates warnings like this:
[WARNING] Warning in manifest for 
se.streamsource.streamflow:streamflow-web:war:1.1-SNAPSHOT : No sub JAR 
or directory WEB-INF/classes
[WARNING] Warning in manifest for 
se.streamsource.streamflow:streamflow-web:war:1.1-SNAPSHOT : No sub JAR 
or directory WEB-INF/lib/somedependency.jar
... and so on with one warning line for each embedded jar ...

The resulting WAR has the correct WEB-INF/lib with all the jar files, 
the BundleClasspath header *is correct* (with all WEB-INF/lib 
dependencies added to it), but the ExportPackage header is wrong as it 
does not include the packages from the dependencies that I want to 
export. Funnily enough, the corresponding ImportPackage header *is 
correct*, i.e. it includes imports of the packages I wanted to export!

Am I doing something wrong here, or is the BND plugin not able to handle 
WAR files with embedded dependencies properly yet?

thanks, Rickard

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


Re: Maven BND plugin and building WAR files with dependencies

Posted by hapa li <kh...@gmail.com>.
Sorry for such a stupid recommendation which has nothing to do with packaging.

On Fri, Jul 9, 2010 at 9:20 PM, hapa li <kh...@gmail.com> wrote:
> Packaging war file with BND is a pain full process. Try Spring DM web extender.
>
> On Fri, Jul 9, 2010 at 8:04 AM, Rickard Öberg <ri...@gmail.com> wrote:
>> On 2010-07-09 13.39, Sanjeeb Sahoo wrote:
>>>
>>> Rickard,
>>>
>>> Are you aware of [1]?
>>
>> Yes, but I have . included:
>>>>
>>>> <Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath>
>>
>> So that's not it.
>>
>> I tried downloading the sample bundle from the OPS4J page
>> (http://wiki.ops4j.org/display/ops4j/Getting+the+benefits+of+maven-bundle-plugin+in+other+project+types),
>> and when I run "mvn install" it actually has the same warning messages, so
>> it's not just me it seems. The difference from that sample is that I want to
>> export a package in an embedded jar, which doesn't work, as the plugin
>> doesn't seem to recognize the jar files properly when using the
>> <Embed-Directory>WEB-INF/lib/</Embed-Directory> instruction.
>>
>> /Rickard
>>
>> ---------------------------------------------------------------------
>> 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 BND plugin and building WAR files with dependencies

Posted by Rickard Öberg <ri...@gmail.com>.
On 2010-07-12 11.53, Richard S. Hall wrote:
> Just an FYI, certain errors during framework startup can be problematic
> when the framework shutdown hook is enabled. You can disable the
> shutdown hook with felix.shutdown.hook=true in conf/config.properties.
> Not sure if that is what you are seeing, but you can try and see if it
> helps you to avoid the hang.

Thanks for the tip, but I'm afraid we have pretty already given up on 
the setup as a whole. We're simply out of time, and can't get it to 
build (the Maven BND issue) nor deploy consistently (the hanging + other 
Glassfish deploy issues). As I said, I would LOVE for this to work, but 
it DOESN'T, and I'm just out of breath and time.

Which means we have to either roll our own (yuck), do plugins through 
REST API's, or skip plugins entirely. I don't like any of the options, 
but such is life.

/Rickard

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


Re: Maven BND plugin and building WAR files with dependencies

Posted by "Richard S. Hall" <he...@ungoverned.org>.
  On 7/11/10 23:37, Rickard Öberg wrote:
> On 2010-07-10 03.20, hapa li wrote:
>> Packaging war file with BND is a pain full process. Try Spring DM web 
>> extender.
>
> Yeah, but it seems I'd have to replace "painful" with "impossible".
>
> It's so sad. On paper doing webapps as bundles looks like an awesome 
> alternative, as we can do jar sharing and functionality plugins easily 
> through OSGi. In practice, using GlassFish/Felix+BND it has proven to 
> be very tough, to the point where I'm close to giving up on the whole 
> thing. GlassFish routinely hangs during deployment so I have to "kill 
> -9" it, 

Just an FYI, certain errors during framework startup can be problematic 
when the framework shutdown hook is enabled. You can disable the 
shutdown hook with felix.shutdown.hook=true in conf/config.properties. 
Not sure if that is what you are seeing, but you can try and see if it 
helps you to avoid the hang.

-> richard

> and Maven BND cannot package my WAR file, as outlined. So I can't 
> build it, and I can't run it. Theory - awesome, Practice - hell.
>
> Maybe I just have to wait a couple of years, until theory and practice 
> are more aligned.
>
> /Rickard
>
> ---------------------------------------------------------------------
> 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 BND plugin and building WAR files with dependencies

Posted by Rickard Öberg <ri...@gmail.com>.
On 2010-07-10 03.20, hapa li wrote:
> Packaging war file with BND is a pain full process. Try Spring DM web extender.

Yeah, but it seems I'd have to replace "painful" with "impossible".

It's so sad. On paper doing webapps as bundles looks like an awesome 
alternative, as we can do jar sharing and functionality plugins easily 
through OSGi. In practice, using GlassFish/Felix+BND it has proven to be 
very tough, to the point where I'm close to giving up on the whole 
thing. GlassFish routinely hangs during deployment so I have to "kill 
-9" it, and Maven BND cannot package my WAR file, as outlined. So I 
can't build it, and I can't run it. Theory - awesome, Practice - hell.

Maybe I just have to wait a couple of years, until theory and practice 
are more aligned.

/Rickard

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


Re: Maven BND plugin and building WAR files with dependencies

Posted by hapa li <kh...@gmail.com>.
Packaging war file with BND is a pain full process. Try Spring DM web extender.

On Fri, Jul 9, 2010 at 8:04 AM, Rickard Öberg <ri...@gmail.com> wrote:
> On 2010-07-09 13.39, Sanjeeb Sahoo wrote:
>>
>> Rickard,
>>
>> Are you aware of [1]?
>
> Yes, but I have . included:
>>>
>>> <Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath>
>
> So that's not it.
>
> I tried downloading the sample bundle from the OPS4J page
> (http://wiki.ops4j.org/display/ops4j/Getting+the+benefits+of+maven-bundle-plugin+in+other+project+types),
> and when I run "mvn install" it actually has the same warning messages, so
> it's not just me it seems. The difference from that sample is that I want to
> export a package in an embedded jar, which doesn't work, as the plugin
> doesn't seem to recognize the jar files properly when using the
> <Embed-Directory>WEB-INF/lib/</Embed-Directory> instruction.
>
> /Rickard
>
> ---------------------------------------------------------------------
> 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 BND plugin and building WAR files with dependencies

Posted by Rickard Öberg <ri...@gmail.com>.
On 2010-07-09 13.39, Sanjeeb Sahoo wrote:
> Rickard,
>
> Are you aware of [1]?

Yes, but I have . included:
>> <Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath>

So that's not it.

I tried downloading the sample bundle from the OPS4J page 
(http://wiki.ops4j.org/display/ops4j/Getting+the+benefits+of+maven-bundle-plugin+in+other+project+types), 
and when I run "mvn install" it actually has the same warning messages, 
so it's not just me it seems. The difference from that sample is that I 
want to export a package in an embedded jar, which doesn't work, as the 
plugin doesn't seem to recognize the jar files properly when using the 
<Embed-Directory>WEB-INF/lib/</Embed-Directory> instruction.

/Rickard

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


Re: Maven BND plugin and building WAR files with dependencies

Posted by Sanjeeb Sahoo <Sa...@Sun.COM>.
Rickard,

Are you aware of [1]?

Thanks,
Sahoo

[1]  https://issues.apache.org/jira/browse/FELIX-1571

On Friday 09 July 2010 09:49 AM, Rickard Öberg wrote:
> Hi,
>
> I'm using the Maven BND plugin to generate the manifest for a WAR file 
> that contains embedded dependencies. I have tried to follow all the 
> guidelines out there (OPS4J+Apache websites), but without luck.
>
> The main problem seems to be that the plugin cannot recognize where 
> the embedded dependencies are. My POM BND instructions look like this:
> <Export-Package>
>     ... exported packages *from embedded dependencies* goes here...
>     ... exported packages from WAR project goes here ...
> </Export-Package>
>
> <Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath>
>
> <Embed-Directory>WEB-INF/lib/</Embed-Directory>
> ... more instructions ...
>
> When I run Maven on this it generates warnings like this:
> [WARNING] Warning in manifest for 
> se.streamsource.streamflow:streamflow-web:war:1.1-SNAPSHOT : No sub 
> JAR or directory WEB-INF/classes
> [WARNING] Warning in manifest for 
> se.streamsource.streamflow:streamflow-web:war:1.1-SNAPSHOT : No sub 
> JAR or directory WEB-INF/lib/somedependency.jar
> ... and so on with one warning line for each embedded jar ...
>
> The resulting WAR has the correct WEB-INF/lib with all the jar files, 
> the BundleClasspath header *is correct* (with all WEB-INF/lib 
> dependencies added to it), but the ExportPackage header is wrong as it 
> does not include the packages from the dependencies that I want to 
> export. Funnily enough, the corresponding ImportPackage header *is 
> correct*, i.e. it includes imports of the packages I wanted to export!
>
> Am I doing something wrong here, or is the BND plugin not able to 
> handle WAR files with embedded dependencies properly yet?
>
> thanks, Rickard
>
> ---------------------------------------------------------------------
> 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