You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Fred Zhang <Fr...@800best.com> on 2008/01/04 01:48:38 UTC

how to use maven project properties in other configuration files?

Hi there,
Sometimes I need to use maven project properties, e.g. ${project.version} etc in some configuration files (not pom.xml or settings.xml). For example, when I build an ear file with the name "EAR-${project.version}.ear", I need to use this ear name in some configuration file for JNDI-lookup.

But how can I use the maven property ${project.version} in configuration files? Is there any plug-in that can make the job done?

Thanks in advance!

Fred Zhang

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


RE: Retrieving and unpacking assemblies

Posted by Matthew Tordoff <ma...@markit.com>.
Hi all,

I found the answer to this here...

http://maven.apache.org/plugins/maven-assembly-plugin/faq.html#classifie
r

You can refer to the assembly using the id of the assembly as the
dependency classifier.

Matt

-----Original Message-----
From: Matthew Tordoff [mailto:matthew.tordoff@markit.com] 
Sent: 07 January 2008 11:22
To: Maven Users List
Subject: Retrieving and unpacking assemblies

Hi all,

I recently created a POM module which as part of it contains a ZIP file
created via the assembly plugin (since the current released version of
Maven does not allow packaging of type ZIP). I have another project
which needs to make use of this ZIP file, so I need that module to
import the original zip file and unpack it. To achieve this I have tried
to use the maven-dependency-plugin, however, I have only been successful
in being able to retrieve the POM file and not the ZIP file.

Does anyone have a proven method for importing and unpacking assemblies
attached to modules?

Any help would be greatly appreciated.

Regards,

Matt

P.S. I have no problems retrieving modules and unpacking them, only
assemblies created as a result of the modules packaging phase.



The content of this e-mail is confidential and may be privileged. It may
be read, copied and used only by the intended recipient and may not be
disclosed, copied or distributed. If you received this email in error,
please contact the sender immediately by return e-mail or by telephoning
+44 20 7260 2000, delete it and do not disclose its contents to any
person. You should take full responsibility for checking this email for
viruses. Markit reserves the right to monitor all e-mail communications
through its network.
Markit and its affiliated companies make no warranty as to the accuracy
or completeness of any information contained in this message and hereby
exclude any liability of any kind for the information contained herein.
Any opinions expressed in this message are those of the author and do
not necessarily reflect the opinions of Markit.
For full details about Markit, its offerings and legal terms and
conditions, please see Markit's website at http://www.markit.com
<http://www.markit.com/> .

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




The content of this e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient and may not be disclosed, copied or distributed. If you received this email in error, please contact the sender immediately by return e-mail or by telephoning +44 20 7260 2000, delete it and do not disclose its contents to any person. You should take full responsibility for checking this email for viruses. Markit reserves the right to monitor all e-mail communications through its network.
Markit and its affiliated companies make no warranty as to the accuracy or completeness of any information contained in this message and hereby exclude any liability of any kind for the information contained herein. Any opinions expressed in this message are those of the author and do not necessarily reflect the opinions of Markit.
For full details about Markit, its offerings and legal terms and conditions, please see Markit's website at http://www.markit.com <http://www.markit.com/> .

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


Retrieving and unpacking assemblies

Posted by Matthew Tordoff <ma...@markit.com>.
Hi all,

I recently created a POM module which as part of it contains a ZIP file
created via the assembly plugin (since the current released version of
Maven does not allow packaging of type ZIP). I have another project
which needs to make use of this ZIP file, so I need that module to
import the original zip file and unpack it. To achieve this I have tried
to use the maven-dependency-plugin, however, I have only been successful
in being able to retrieve the POM file and not the ZIP file.

Does anyone have a proven method for importing and unpacking assemblies
attached to modules?

Any help would be greatly appreciated.

Regards,

Matt

P.S. I have no problems retrieving modules and unpacking them, only
assemblies created as a result of the modules packaging phase.



The content of this e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient and may not be disclosed, copied or distributed. If you received this email in error, please contact the sender immediately by return e-mail or by telephoning +44 20 7260 2000, delete it and do not disclose its contents to any person. You should take full responsibility for checking this email for viruses. Markit reserves the right to monitor all e-mail communications through its network.
Markit and its affiliated companies make no warranty as to the accuracy or completeness of any information contained in this message and hereby exclude any liability of any kind for the information contained herein. Any opinions expressed in this message are those of the author and do not necessarily reflect the opinions of Markit.
For full details about Markit, its offerings and legal terms and conditions, please see Markit's website at http://www.markit.com <http://www.markit.com/> .

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


答复: how to use maven project properties in other configuration files?

Posted by Fred Zhang <Fr...@800best.com>.
Kalle, Thanks a lot!


-----邮件原件-----
发件人: Kalle Korhonen [mailto:kalle.o.korhonen@gmail.com]
发送时间: 2008年1月7日 11:47
收件人: Maven Users List
主题: Re: how to use maven project properties in other configuration files?

On 1/6/08, Fred Zhang <Fr...@800best.com> wrote:
>
> My project is a multi-module project which contains an ear module and a
> war module. I need to access the property of the ear module (for the ear
> name and version) from the war module or from the project root pom.
> Is that possible to access properties of a module from another module or
> from the project root pom in maven?
>

No, but the properties declared in the parent pom (
http://maven.apache.org/pom.html#Properties) are available in the child
modules, so you'd need to organize your project so that the parent is
driving setting the properties and both ear and war are using them.

Kalle


-----Original message-----------
> From: Kalle Korhonen [mailto:kalle.o.korhonen@gmail.com]
> Sent: Jan.04.2008 16:31
> To: Maven Users List
> Subject: Re: how to use maven project properties in other configuration
> files?
>
> Make your configuration file a filtered resource:
>
> http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html
>
> Kalle
>
> On 1/3/08, Fred Zhang <Fr...@800best.com> wrote:
> >
> > Hi there,
> > Sometimes I need to use maven project properties, e.g. ${project.version
> }
> > etc in some configuration files (not pom.xml or settings.xml). For
> > example, when I build an ear file with the name "EAR-${project.version
> }.ear",
> > I need to use this ear name in some configuration file for JNDI-lookup.
> >
> > But how can I use the maven property ${project.version} in configuration
> > files? Is there any plug-in that can make the job done?
> >
> > Thanks in advance!
> >
> > Fred Zhang
> >
> > ---------------------------------------------------------------------
> > 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: how to use maven project properties in other configuration files?

Posted by Kalle Korhonen <ka...@gmail.com>.
On 1/6/08, Fred Zhang <Fr...@800best.com> wrote:
>
> My project is a multi-module project which contains an ear module and a
> war module. I need to access the property of the ear module (for the ear
> name and version) from the war module or from the project root pom.
> Is that possible to access properties of a module from another module or
> from the project root pom in maven?
>

No, but the properties declared in the parent pom (
http://maven.apache.org/pom.html#Properties) are available in the child
modules, so you'd need to organize your project so that the parent is
driving setting the properties and both ear and war are using them.

Kalle


-----Original message-----------
> From: Kalle Korhonen [mailto:kalle.o.korhonen@gmail.com]
> Sent: Jan.04.2008 16:31
> To: Maven Users List
> Subject: Re: how to use maven project properties in other configuration
> files?
>
> Make your configuration file a filtered resource:
>
> http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html
>
> Kalle
>
> On 1/3/08, Fred Zhang <Fr...@800best.com> wrote:
> >
> > Hi there,
> > Sometimes I need to use maven project properties, e.g. ${project.version
> }
> > etc in some configuration files (not pom.xml or settings.xml). For
> > example, when I build an ear file with the name "EAR-${project.version
> }.ear",
> > I need to use this ear name in some configuration file for JNDI-lookup.
> >
> > But how can I use the maven property ${project.version} in configuration
> > files? Is there any plug-in that can make the job done?
> >
> > Thanks in advance!
> >
> > Fred Zhang
> >
> > ---------------------------------------------------------------------
> > 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: how to use maven project properties in other configuration files?

Posted by Fred Zhang <Fr...@800best.com>.
Thanks Kalle!

My project is a multi-module project which contains an ear module and a war module. I need to access the property of the ear module (for the ear name and version) from the war module or from the project root pom.

Is that possible to access properties of a module from another module or from the project root pom in maven?

Best Regards

Fred Zhang



-----Original message-----------
From: Kalle Korhonen [mailto:kalle.o.korhonen@gmail.com]
Sent: Jan.04.2008 16:31
To: Maven Users List
Subject: Re: how to use maven project properties in other configuration files?

Make your configuration file a filtered resource:
http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html

Kalle

On 1/3/08, Fred Zhang <Fr...@800best.com> wrote:
>
> Hi there,
> Sometimes I need to use maven project properties, e.g. ${project.version}
> etc in some configuration files (not pom.xml or settings.xml). For
> example, when I build an ear file with the name "EAR-${project.version}.ear",
> I need to use this ear name in some configuration file for JNDI-lookup.
>
> But how can I use the maven property ${project.version} in configuration
> files? Is there any plug-in that can make the job done?
>
> Thanks in advance!
>
> Fred Zhang
>
> ---------------------------------------------------------------------
> 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: how to use maven project properties in other configuration files?

Posted by Kalle Korhonen <ka...@gmail.com>.
Make your configuration file a filtered resource:
http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html

Kalle

On 1/3/08, Fred Zhang <Fr...@800best.com> wrote:
>
> Hi there,
> Sometimes I need to use maven project properties, e.g. ${project.version}
> etc in some configuration files (not pom.xml or settings.xml). For
> example, when I build an ear file with the name "EAR-${project.version}.ear",
> I need to use this ear name in some configuration file for JNDI-lookup.
>
> But how can I use the maven property ${project.version} in configuration
> files? Is there any plug-in that can make the job done?
>
> Thanks in advance!
>
> Fred Zhang
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>