Which packaging do have? Can you post your POM?
Am 21.07.2012 22:51 schrieb "Tommy Svensson" <[email protected]>:

> Hello maven fans,
>
> I've become slightly balder today. I've been tearing my hair over why JPA
> keeps insisting it cannot find my persistence unit. Everything in my
> persistence.xml file is correct I've checked it over an over.
>
> I've just discovered that the problem is not in the JPA provider (tried
> both EclipseLink and OpenJPA), but in Maven!!!
>
> Maven just refuses to include META-INF/persistence.xml in the jar no
> matter what I do! It resides in src/main/resources/META-INF. After building
> it is also in target/classes/META-INF along with MANIFEST.MF, but it is
> missing in the jar file.
>
> I googled and someone suggested this (yes, I'm not alone with this
> problem):
>
>         <resources>
>             <resource>
>                 <filtering>false</filtering>
>                 <directory>${basedir}/src/main/resources</directory>
>                 <includes>
>                     <include>META-INF/persistence.xml</include>
>                 </includes>
>             </resource>
>         </resources>
>
> That however had no effect what so ever. Next I tried this:
>
>             <plugin>
>                 <artifactId>maven-jar-plugin</artifactId>
>                 <configuration>
>                     <includes>
>                         <include>META-INF/persistence.xml</include>
>                     </includes>
>                     <archive>
>
> <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
>                     </archive>
>                 </configuration>
>             </plugin>
>
> That didn't help either. Then I found at codehaus that this was a bug and
> that it was fixed in version 2.1 of the maven-jar-plugin. So I tried to add
> version to the plugin specification. Version 2.4 was the latest I found:
>
>             <plugin>
>                 <artifactId>maven-jar-plugin</artifactId>
>                 <version>2.4</version>
>                 <configuration>
>                     <includes>
>                         <include>META-INF/persistence.xml</include>
>                     </includes>
>                     <archive>
>
> <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
>                     </archive>
>                 </configuration>
>             </plugin>
>
> That didn't work either. I'm out of ideas and my fingers hurt from all the
> googling. Do anyone have any idea how to solve this truly annoying problem ?
>
> I can add that I'm also using the Apache Felix maven-bundle-plugin. I
> don't know if it can affect this behavior.
>
> Anyhow, any suggestions are appreciated. Currently I have to manually jar
> my project.
>
> Regards,
> Tommy Svensson
>
>

Reply via email to