You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Tommy Svensson <to...@me.com> on 2012/08/11 18:56:43 UTC

Re: maven-jar-plugin refuses to include META-INF/persistence.xml ! - Problem solved

I finally found the source of this problem! Or close to it at least. I have managed to get my META-INF/persistence.xml included in the jar, but I'm unsure what is to blame :-).

I'm also using the Apache Felix bundle-plugin which allows for:

	<packaging>bundle</packaging>

This due to the following configuration:

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.5</version>
                <extensions>true</extensions>
               ...
                <configuration>
                    <supportedProjectTypes>
                        <supportedProjectType>jar</supportedProjectType>
                        <supportedProjectType>bundle</supportedProjectType>
                    </supportedProjectTypes>
                    ...
                </configuration>
            </plugin>

That is, I can use either or of "bundle" or "jar" for packaging. However when i use:

	<packaging>bundle</packaging>

I don't get the META-INF/persistence.xml file in the jar.

But when I change to:

	<packaging>jar</packaging>

It is included! So my guess is that the maven-jar-plugin is affected by the packaging. The Felix bundle-plugin still works OK with packaging "jar" so I'll stick with that for now on.

/Tommy

22 jul 2012 kl. 18:27 skrev Wayne Fay <wa...@gmail.com>:

>> I was hoping for a "Well, thats easy, just do ..." :-). But you are of course right
>> Wayne, I need to isolate what is causing this. Thanks.
> 
> If META-INF/persistence.xml was not even showing up in target, then we
> might be able to provide a simple "recipe" to solve it. But that is
> not the case here. Come back and let us know when you solve it.
> 
> Wayne
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


Re: maven-jar-plugin refuses to include META-INF/persistence.xml ! - Problem solved

Posted by Wayne Fay <wa...@gmail.com>.
>> Most likely the "bundle" packaging does not include META-INF for some
>> reason. I would talk to the Apache Felix people about this issue so
>> they can resolve it in their code.
>
> This is working as designed, as covered in the FAQ:

Thanks Stuart. This is a good thing to keep in mind for when future
felix users land here complaining about similar problems.

Wayne

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


Re: maven-jar-plugin refuses to include META-INF/persistence.xml ! - Problem solved

Posted by Stuart McCulloch <mc...@gmail.com>.
On 12 Aug 2012, at 03:54, Wayne Fay <wa...@gmail.com> wrote:

>> I'm also using the Apache Felix bundle-plugin which allows for:
>> 
>>        <packaging>bundle</packaging>
> 
> This is not a packaging delivered by Apache Maven. Thus you can
> "blame" whoever is making this packaging available to you.
> 
>> That is, I can use either or of "bundle" or "jar" for packaging. However when i use:
>> 
>>        <packaging>bundle</packaging>
>> 
>> I don't get the META-INF/persistence.xml file in the jar.
> 
> Most likely the "bundle" packaging does not include META-INF for some
> reason. I would talk to the Apache Felix people about this issue so
> they can resolve it in their code.

This is working as designed, as covered in the FAQ:

   http://felix.apache.org/site/apache-felix-bundle-plugin-faq.html#ApacheFelixBundlePluginFAQ-WhenIbuildabundle%252Csomeclassesarebuiltin%2522target%252Fclasses%2522butthey%2527renotincludedinthefinaljar.

Not everything in target/classes ends up in the bundle by default (unlike jar) - the underlying bnd library will only pull what resources/packages you tell it to into the bundle. While the plugin attempts to generate reasonable defaults based on your source, it can't do this for generated resources such as this persistence.xml file (see last FAQ item). Instead you need something like:

   <Include-Resource>{maven-resources}, META-INF/persistence.xml=target/classes/META-INF/persistence.xml</Include-Resource>

Where {maven-resources} is a placeholder for the default detected resources, as described in the Include-Resource section of http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html

The raw format of bnd's Include-Resource instruction can be found at http://www.aqute.biz/Bnd/Format#include-resource

HTH

--
Cheers, Stuart

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

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


Re: maven-jar-plugin refuses to include META-INF/persistence.xml ! - Problem solved

Posted by Wayne Fay <wa...@gmail.com>.
> I'm also using the Apache Felix bundle-plugin which allows for:
>
>         <packaging>bundle</packaging>

This is not a packaging delivered by Apache Maven. Thus you can
"blame" whoever is making this packaging available to you.

> That is, I can use either or of "bundle" or "jar" for packaging. However when i use:
>
>         <packaging>bundle</packaging>
>
> I don't get the META-INF/persistence.xml file in the jar.

Most likely the "bundle" packaging does not include META-INF for some
reason. I would talk to the Apache Felix people about this issue so
they can resolve it in their code.

Wayne

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


Re: maven-jar-plugin refuses to include META-INF/persistence.xml ! - Problem solved

Posted by Mark Derricutt <ma...@talios.com>.
If you use the <packaging>bundle</packaging> style in your pom, then its bnd that does the actual jar creation, and NOT the traditional jar plugin.

We hit this same issue awhile ago when including compiled coffee-script into our jars, just putting them directly in target/classes doesn't "just work".

Mark

On 13/08/2012, at 2:29 AM, Tommy Svensson <to...@natusoft.se> wrote:

> I didn't know that the bundle-plugin affected jar:ing. I thought it just packaged things correctly under target and then the maven-jar-plugin did the rest. 


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


RE: maven-jar-plugin refuses to include META-INF/persistence.xml ! - Problem solved

Posted by Martin Gainty <mg...@hotmail.com>.
from now on we're going to rely on you... as our BND expert!

Glad to hear that worked
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.


> Subject: Re: maven-jar-plugin refuses to include META-INF/persistence.xml ! - Problem solved
> From: tommy@natusoft.se
> Date: Sun, 12 Aug 2012 16:29:18 +0200
> To: users@maven.apache.org
> 
> I pulled those parts out and replaced them with "..." to make the example smaller. I didn't think those parts relevant, but apparently they are since the following suggested by Stuart McCulloch does work:
> 
> 	<Include-Resource>{maven-resources}, META-INF/persistence.xml=target/classes/META-INF/persistence.xml</Include-Resource>
> 
> I didn't know that the bundle-plugin affected jar:ing. I thought it just packaged things correctly under target and then the maven-jar-plugin did the rest. 
> 
> I'm starting to realize that just assuming is probably a bad idea ...
> 
> /Tommy 
> 
> 12 aug 2012 kl. 03:54 skrev Martin Gainty <mg...@hotmail.com>:
> 
> > 
> > http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
> > 
> > I didnt see your  
> > Export-Package
> > Private-Package
> > Bundle-Activator
> > At execution time you will need to config the maven-bundle-plugin with configuration instructions such as what is here:
> > <build>
> >   <plugins>
> >     <plugin>    <!-- (2) START -->
> >       <groupId>org.apache.felix</groupId>
> >       <artifactId>maven-bundle-plugin</artifactId>
> >       <extensions>true</extensions>
> >       <configuration>
> >         <instructions>
> >           <Export-Package>com.my.company.api</Export-Package>
> >           <Private-Package>com.my.company.*</Private-Package>
> >           <Bundle-Activator>com.my.company.Activator</Bundle-Activator>
> >         </instructions>
> >       </configuration>
> >     </plugin>    <!-- (2) END -->
> >   </plugins>
> > </build> The Export-Package of com.my.company.api indicates
> > the plugin will copy the Log Service package into the resulting bundle JAR file and export to other bundles
> > The Private-Package of com.my.company.* indicates
> > the available package(s) to copy into the bundle but NOT export to other bundles
> > 
> > But if you really want total control of your bundle you'll want to learn BND
> > The *best* example of BND configuration and an explanation of BND supported attributes are located here
> > http://www.aqute.biz/Bnd/Bnd
> > 
> > Martin Gainty 
> > ______________________________________________ 
> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
> > 
> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
> > 
> > 
> >> From: tommybsvensson@me.com
> >> Subject: Re: maven-jar-plugin refuses to include META-INF/persistence.xml ! - Problem solved
> >> Date: Sat, 11 Aug 2012 18:56:43 +0200
> >> To: users@maven.apache.org
> >> 
> >> I finally found the source of this problem! Or close to it at least. I have managed to get my META-INF/persistence.xml included in the jar, but I'm unsure what is to blame :-).
> >> 
> >> I'm also using the Apache Felix bundle-plugin which allows for:
> >> 
> >> 	<packaging>bundle</packaging>
> >> 
> >> This due to the following configuration:
> >> 
> >>           <plugin>
> >>               <groupId>org.apache.felix</groupId>
> >>               <artifactId>maven-bundle-plugin</artifactId>
> >>               <version>2.3.5</version>
> >>               <extensions>true</extensions>
> >>              ...
> >>               <configuration>
> >>                   <supportedProjectTypes>
> >>                       <supportedProjectType>jar</supportedProjectType>
> >>                       <supportedProjectType>bundle</supportedProjectType>
> >>                   </supportedProjectTypes>
> >>                   ...
> >>               </configuration>
> >>           </plugin>
> >> 
> >> That is, I can use either or of "bundle" or "jar" for packaging. However when i use:
> >> 
> >> 	<packaging>bundle</packaging>
> >> 
> >> I don't get the META-INF/persistence.xml file in the jar.
> >> 
> >> But when I change to:
> >> 
> >> 	<packaging>jar</packaging>
> >> 
> >> It is included! So my guess is that the maven-jar-plugin is affected by the packaging. The Felix bundle-plugin still works OK with packaging "jar" so I'll stick with that for now on.
> >> 
> >> /Tommy
> >> 
> >> 22 jul 2012 kl. 18:27 skrev Wayne Fay <wa...@gmail.com>:
> >> 
> >>>> I was hoping for a "Well, thats easy, just do ..." :-). But you are of course right
> >>>> Wayne, I need to isolate what is causing this. Thanks.
> >>> 
> >>> If META-INF/persistence.xml was not even showing up in target, then we
> >>> might be able to provide a simple "recipe" to solve it. But that is
> >>> not the case here. Come back and let us know when you solve it.
> >>> 
> >>> Wayne
> >>> 
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>> For additional commands, e-mail: users-help@maven.apache.org
> >>> 
> >> 
> > 		 	   		  
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
 		 	   		  

Re: maven-jar-plugin refuses to include META-INF/persistence.xml ! - Problem solved

Posted by Tommy Svensson <to...@natusoft.se>.
I pulled those parts out and replaced them with "..." to make the example smaller. I didn't think those parts relevant, but apparently they are since the following suggested by Stuart McCulloch does work:

	<Include-Resource>{maven-resources}, META-INF/persistence.xml=target/classes/META-INF/persistence.xml</Include-Resource>

I didn't know that the bundle-plugin affected jar:ing. I thought it just packaged things correctly under target and then the maven-jar-plugin did the rest. 

I'm starting to realize that just assuming is probably a bad idea ...

/Tommy 

12 aug 2012 kl. 03:54 skrev Martin Gainty <mg...@hotmail.com>:

> 
> http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
> 
> I didnt see your  
> Export-Package
> Private-Package
> Bundle-Activator
> At execution time you will need to config the maven-bundle-plugin with configuration instructions such as what is here:
> <build>
>   <plugins>
>     <plugin>    <!-- (2) START -->
>       <groupId>org.apache.felix</groupId>
>       <artifactId>maven-bundle-plugin</artifactId>
>       <extensions>true</extensions>
>       <configuration>
>         <instructions>
>           <Export-Package>com.my.company.api</Export-Package>
>           <Private-Package>com.my.company.*</Private-Package>
>           <Bundle-Activator>com.my.company.Activator</Bundle-Activator>
>         </instructions>
>       </configuration>
>     </plugin>    <!-- (2) END -->
>   </plugins>
> </build> The Export-Package of com.my.company.api indicates
> the plugin will copy the Log Service package into the resulting bundle JAR file and export to other bundles
> The Private-Package of com.my.company.* indicates
> the available package(s) to copy into the bundle but NOT export to other bundles
> 
> But if you really want total control of your bundle you'll want to learn BND
> The *best* example of BND configuration and an explanation of BND supported attributes are located here
> http://www.aqute.biz/Bnd/Bnd
> 
> Martin Gainty 
> ______________________________________________ 
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
> 
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
> 
> 
>> From: tommybsvensson@me.com
>> Subject: Re: maven-jar-plugin refuses to include META-INF/persistence.xml ! - Problem solved
>> Date: Sat, 11 Aug 2012 18:56:43 +0200
>> To: users@maven.apache.org
>> 
>> I finally found the source of this problem! Or close to it at least. I have managed to get my META-INF/persistence.xml included in the jar, but I'm unsure what is to blame :-).
>> 
>> I'm also using the Apache Felix bundle-plugin which allows for:
>> 
>> 	<packaging>bundle</packaging>
>> 
>> This due to the following configuration:
>> 
>>           <plugin>
>>               <groupId>org.apache.felix</groupId>
>>               <artifactId>maven-bundle-plugin</artifactId>
>>               <version>2.3.5</version>
>>               <extensions>true</extensions>
>>              ...
>>               <configuration>
>>                   <supportedProjectTypes>
>>                       <supportedProjectType>jar</supportedProjectType>
>>                       <supportedProjectType>bundle</supportedProjectType>
>>                   </supportedProjectTypes>
>>                   ...
>>               </configuration>
>>           </plugin>
>> 
>> That is, I can use either or of "bundle" or "jar" for packaging. However when i use:
>> 
>> 	<packaging>bundle</packaging>
>> 
>> I don't get the META-INF/persistence.xml file in the jar.
>> 
>> But when I change to:
>> 
>> 	<packaging>jar</packaging>
>> 
>> It is included! So my guess is that the maven-jar-plugin is affected by the packaging. The Felix bundle-plugin still works OK with packaging "jar" so I'll stick with that for now on.
>> 
>> /Tommy
>> 
>> 22 jul 2012 kl. 18:27 skrev Wayne Fay <wa...@gmail.com>:
>> 
>>>> I was hoping for a "Well, thats easy, just do ..." :-). But you are of course right
>>>> Wayne, I need to isolate what is causing this. Thanks.
>>> 
>>> If META-INF/persistence.xml was not even showing up in target, then we
>>> might be able to provide a simple "recipe" to solve it. But that is
>>> not the case here. Come back and let us know when you solve it.
>>> 
>>> Wayne
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>> 
>> 
> 		 	   		  


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


RE: maven-jar-plugin refuses to include META-INF/persistence.xml ! - Problem solved

Posted by Martin Gainty <mg...@hotmail.com>.
http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html

I didnt see your  
Export-Package
Private-Package
Bundle-Activator
At execution time you will need to config the maven-bundle-plugin with configuration instructions such as what is here:
 <build>
    <plugins>
      <plugin>    <!-- (2) START -->
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Export-Package>com.my.company.api</Export-Package>
            <Private-Package>com.my.company.*</Private-Package>
            <Bundle-Activator>com.my.company.Activator</Bundle-Activator>
          </instructions>
        </configuration>
      </plugin>    <!-- (2) END -->
    </plugins>
  </build> The Export-Package of com.my.company.api indicates
the plugin will copy the Log Service package into the resulting bundle JAR file and export to other bundles
The Private-Package of com.my.company.* indicates
the available package(s) to copy into the bundle but NOT export to other bundles

But if you really want total control of your bundle you'll want to learn BND
The *best* example of BND configuration and an explanation of BND supported attributes are located here
http://www.aqute.biz/Bnd/Bnd

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.


> From: tommybsvensson@me.com
> Subject: Re: maven-jar-plugin refuses to include META-INF/persistence.xml ! - Problem solved
> Date: Sat, 11 Aug 2012 18:56:43 +0200
> To: users@maven.apache.org
> 
> I finally found the source of this problem! Or close to it at least. I have managed to get my META-INF/persistence.xml included in the jar, but I'm unsure what is to blame :-).
> 
> I'm also using the Apache Felix bundle-plugin which allows for:
> 
> 	<packaging>bundle</packaging>
> 
> This due to the following configuration:
> 
>             <plugin>
>                 <groupId>org.apache.felix</groupId>
>                 <artifactId>maven-bundle-plugin</artifactId>
>                 <version>2.3.5</version>
>                 <extensions>true</extensions>
>                ...
>                 <configuration>
>                     <supportedProjectTypes>
>                         <supportedProjectType>jar</supportedProjectType>
>                         <supportedProjectType>bundle</supportedProjectType>
>                     </supportedProjectTypes>
>                     ...
>                 </configuration>
>             </plugin>
> 
> That is, I can use either or of "bundle" or "jar" for packaging. However when i use:
> 
> 	<packaging>bundle</packaging>
> 
> I don't get the META-INF/persistence.xml file in the jar.
> 
> But when I change to:
> 
> 	<packaging>jar</packaging>
> 
> It is included! So my guess is that the maven-jar-plugin is affected by the packaging. The Felix bundle-plugin still works OK with packaging "jar" so I'll stick with that for now on.
> 
> /Tommy
> 
> 22 jul 2012 kl. 18:27 skrev Wayne Fay <wa...@gmail.com>:
> 
> >> I was hoping for a "Well, thats easy, just do ..." :-). But you are of course right
> >> Wayne, I need to isolate what is causing this. Thanks.
> > 
> > If META-INF/persistence.xml was not even showing up in target, then we
> > might be able to provide a simple "recipe" to solve it. But that is
> > not the case here. Come back and let us know when you solve it.
> > 
> > Wayne
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
>