Hello all,
How do I get Maven to include persistence.xml into a web app??
Any clue welcome!
Julien.
Here is my POM:
project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=
http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=
http://maven.apache.org/POM/4.0.0
persistence.xml needs to be on the class path doesn't it?
Create a directory src/main/java/resources and put it in there. When
maven packages up your war it will put all files in the resources
directory into your war file under the WEB-INF/classes directory.
Hope this helps.
Ben
On 8/28/07,
Thanks Ben,
Is there not a way to put it (persistence.xml) into meta-inf instead?
Julien.
2007/8/28, ben short [EMAIL PROTECTED]:
persistence.xml needs to be on the class path doesn't it?
Create a directory src/main/java/resources and put it in there. When
maven packages up your war it will
I think you can just create /src/main/webapp/META-INF and put it in there.
On 8/28/07, Julien Martin [EMAIL PROTECTED] wrote:
Thanks Ben,
Is there not a way to put it (persistence.xml) into meta-inf instead?
Julien.
2007/8/28, ben short [EMAIL PROTECTED]:
persistence.xml needs to be on
Hi Julien,
you can configure aditional resources through the war plugin.
http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filteri
ng-webresources.html
So you need something like this
!-- All webapps filter and add **/**.xml in src/main/config tp the war
--
plugin
The problem is that I have to use an existing path i.e.
(MyProject\src\conf\persistence.xml) and cannot change that
Is there not a way to modify the POM in order for it to include my
persistence.xml??
Sorry I am a real beginner at Maven...
Julien.
2007/8/28, ben short [EMAIL PROTECTED]:
I
Hi,
this should do what you want:
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-war-plugin/artifactId
configuration
webResources
resource
directorysrc/conf/directory
!-- override the destination directory for this resource --
Thanks Tim for you suggestion. I thought I was getting there but apparently
the targetPath is COMPLETELY ignored by Maven... Here is where the
persistence.xml is copied: the root of the war...
Here is my POM for your info. Tis almost identical to your suggestion:
project
Thank!!
2007/8/28, Tim Kettler [EMAIL PROTECTED]:
Strange, it's working for me with this simple test project:
project
modelVersion4.0.0/modelVersion
artifactIdmy-test-app/artifactId
groupIdmy-test-group/groupId
version1.0-SNAPSHOT/version
Strange, it's working for me with this simple test project:
project
modelVersion4.0.0/modelVersion
artifactIdmy-test-app/artifactId
groupIdmy-test-group/groupId
version1.0-SNAPSHOT/version
packagingwar/packaging
build
plugins
plugin
10 matches
Mail list logo