You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jean-Claude <je...@ipi.ch> on 2009/04/21 19:03:12 UTC

maven-ear-plugin or maven-ejb-plugin and persistence.xml

Hi,

We are using maven2, JBoss 5 and Hibernate with the file persistence.xml
according to the specifications.

In the file persistence.xml we have to list the jar files like it:
    <jar-file>./activity-bo-1.0.0-SNAPSHOT.jar</jar-file>
    <jar-file>./core-bo-1.0.0-SNAPSHOT.jar</jar-file>

These jar files appear in persistence.xml with their version (1.0.0-SNAPSHOT
in this case).

Is it a way to automatically generate the list of the jar files to avoid
having to manually edit the file persistence.xml each time there is a new
version of the jar files (e.g. using the maven-ejb-plugin)?

Thank you for your help
J.-Claude
-- 
View this message in context: http://www.nabble.com/maven-ear-plugin-or-maven-ejb-plugin-and-persistence.xml-tp23160597p23160597.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: maven-ear-plugin or maven-ejb-plugin and persistence.xml

Posted by Stephane Nicoll <st...@gmail.com>.
Jean-Claude,

On Tue, Apr 21, 2009 at 7:03 PM, Jean-Claude <je...@ipi.ch>wrote:

>
> Is it a way to automatically generate the list of the jar files to avoid
> having to manually edit the file persistence.xml each time there is a new
> version of the jar files (e.g. using the maven-ejb-plugin)?
>

There's two ways you can do this. The first is to store the version in a
property in your pom and use it in your dependency and in the
persistence.xml and filter it when the EJB is built. Something like

<properties>
  <foo.version>1.0.0-SNAPSHOT</foo.version>
</properties>

.....

<depepdencies>
   <dependency>
     <groupId>com.foo</groupId>
     <artifactId>activity-bo</artifactId>
     <version>${foo.version}</version>
     <type>ejb</type>
  </dependency>
</dependencies>
....

(Then put the ${foo.version} in your persistence.xml instead of the version
and configure the build to filter it)

The other way is to ask the ear plugin to change the name of the file when
it's packaged. See the documentation for more details
http://maven.apache.org/plugins/maven-ear-plugin/examples/customizing-a-module-filename.html

HTH,
Stéphane



-- 
Large Systems Suck: This rule is 100% transitive. If you build one, you
suck" -- S.Yegge