You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by an...@nokia.com on 2006/03/17 17:27:51 UTC

RE: Properties/Variables in pom?

Hi,

Are the default properties documented at all somewhere?

 _         __                _  _
//\ndreas.[|-bbert-[]/arroum(a)[|\|okia.com
           `-        `
   Andreas Ebbert-Karroum
   Software Design Engineer - Nokia Networks Services / Middleware 
   phone: +49-211-94123928, fax: +49-211-9412-3838
   Heltorfer Straße 1, 40472 Düsseldorf, Germany 

----------------------------------------------------------------------
This message is confidential. If you have received this message in error,
please delete it from your system. You should not copy it for any purpose,
or disclose its contents to any other person. Internet communications are
not secure and therefore Nokia GmbH does not accept legal responsibility
for the contents of this message as it has been transmitted over a public
network. Thank you.
Nokia GmbH, Nokia Networks is a German Company. Further information
about the Company is available from its principal offices at
Heltorferstrasse 1, D-40472, Düsseldorf, Germany and from the
website at http://www.nokia.com/
---------------------------------------------------------------------- 

>-----Original Message-----
>From: ext 
>users-return-42636-andreas.ebbert-karroum=nokia.com@maven.apach
>e.org 
>[mailto:users-return-42636-andreas.ebbert-karroum=nokia.com@mav
>en.apache.org] 
>Sent: 16 March, 2006 12:40
>To: users@maven.apache.org
>Subject: Variables in pom?
>
>Hi,
> 
>where are the variables documented, that I can use inside the 
>POM? I guess there's something available like ${artifactId} 
>and alike, but I couldn't find a place, where they're all 
>listed and described.
> 
>Andreas Ebbert-Karroum
>  Software Design Engineer - Nokia Networks Services / Middleware
>  phone: +49-211-94123928, fax: +49-211-94123838
>  Heltorfer Straße 1, 40472 Düsseldorf, Germany 
>
>
>________________________________
>
>This message is confidential. If you have received this 
>message in error, please delete it from your system. You 
>should not copy it for any purpose, or disclose its contents 
>to any other person. Internet communications are not secure 
>and therefore Nokia GmbH does not accept legal responsibility 
>for the contents of this message as it has been transmitted 
>over a public network. Thank you. 
>
>Nokia GmbH, Nokia Networks is a German Company. Further 
>information about the Company is available from its principal 
>offices at Heltorferstrasse 1, D-40472, Düsseldorf, Germany 
>and from the website at http://www.nokia.com/ 
>________________________________
>
>
>

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


Re: Properties/Variables in pom?

Posted by Jesse McConnell <je...@gmail.com>.
I'll explain a bit more...

you see how the pom.xml is laid out, right?

<project>
   <build>
      <outputDirectory>{$basedir}target/classes</outputDirectory>

<testOutputDirectory>${basedir}target/test-classes</testOutputDirectory>
   </build>
</project>

there is a super-pom which is the parent of all the pom.xml that users
create, in that super pom a mess of these things are defined as the defaults
for the project, where the build output would go, where the test classes
will go, etc.

you can refer to a lot of these things like ${project.build.outputDirectory}
in expressions in your poms and those are ironed out when the private
variables are being injected.

I don't know if there is a full listing of what these all are, but that is
the 'how' and 'why' they exist

if you want to know more, just ask

jesse


On 3/17/06, dan tran <da...@gmail.com> wrote:
>
> Most of your pom's element can be referenced as ${project.x.y....},
>
> so ${project.build.directory} by default is path_to_your "target" dir.
>
> -D
>
>
> On 3/17/06, andreas.ebbert-karroum@nokia.com <
> andreas.ebbert-karroum@nokia.com> wrote:
> >
> > Hi Dan,
> >
> > >-----Original Message-----
> > >From: ext dan tran [mailto:dantran@gmail.com]
> > >Sent: 17 March, 2006 20:03
> >
> > >You can use the pom itself, ie ${project.build.directory}
> > >
> > >-D
> >
> > Sorry, I don't understand, what you're trying to tell me :-) Can you
> > please add one or two sentences :-) Is ${project.build.directory} one
> > variable or can I somehow look the others up by using that?
> >
> > _         __                _  _
> > //\ndreas.[|-bbert-[]/arroum(a)[|\|okia.com
> >           `-        `
> >   Andreas Ebbert-Karroum
> > Software Design Engineer - Nokia Networks Services / Middleware
> > phone: +49-211-94123928, fax: +49-211-9412-3838
> > Heltorfer Straße 1, 40472 Düsseldorf, Germany
> >
> > ----------------------------------------------------------------------
> > This message is confidential. If you have received this message in
> error,
> > please delete it from your system. You should not copy it for any
> purpose,
> > or disclose its contents to any other person. Internet communications
> are
> > not secure and therefore Nokia GmbH does not accept legal responsibility
> > for the contents of this message as it has been transmitted over a
> public
> > network. Thank you.
> > Nokia GmbH, Nokia Networks is a German Company. Further information
> > about the Company is available from its principal offices at
> > Heltorferstrasse 1, D-40472, Düsseldorf, Germany and from the
> > website at http://www.nokia.com/
> > ----------------------------------------------------------------------
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>


--
jesse mcconnell

Re: Properties/Variables in pom?

Posted by dan tran <da...@gmail.com>.
Most of your pom's element can be referenced as ${project.x.y....},

so ${project.build.directory} by default is path_to_your "target" dir.

-D


On 3/17/06, andreas.ebbert-karroum@nokia.com <
andreas.ebbert-karroum@nokia.com> wrote:
>
> Hi Dan,
>
> >-----Original Message-----
> >From: ext dan tran [mailto:dantran@gmail.com]
> >Sent: 17 March, 2006 20:03
>
> >You can use the pom itself, ie ${project.build.directory}
> >
> >-D
>
> Sorry, I don't understand, what you're trying to tell me :-) Can you
> please add one or two sentences :-) Is ${project.build.directory} one
> variable or can I somehow look the others up by using that?
>
> _         __                _  _
> //\ndreas.[|-bbert-[]/arroum(a)[|\|okia.com
>           `-        `
>   Andreas Ebbert-Karroum
> Software Design Engineer - Nokia Networks Services / Middleware
> phone: +49-211-94123928, fax: +49-211-9412-3838
> Heltorfer Straße 1, 40472 Düsseldorf, Germany
>
> ----------------------------------------------------------------------
> This message is confidential. If you have received this message in error,
> please delete it from your system. You should not copy it for any purpose,
> or disclose its contents to any other person. Internet communications are
> not secure and therefore Nokia GmbH does not accept legal responsibility
> for the contents of this message as it has been transmitted over a public
> network. Thank you.
> Nokia GmbH, Nokia Networks is a German Company. Further information
> about the Company is available from its principal offices at
> Heltorferstrasse 1, D-40472, Düsseldorf, Germany and from the
> website at http://www.nokia.com/
> ----------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Properties/Variables in pom?

Posted by Gunther Popp <ma...@guntherpopp.de>.
Hi!

AFAIK, this only works _within_ the POM itself (i.e. in the 
configuration section of plugins). I don´t know if it works for the 
file-filtering stuff.

CU,

Gunther

Gareth Tilley schrieb:
> Hi All,
>
>
> Gunther Popp-2 wrote:
>   
>> - All (platform-specific) Environment variables (Just add the prefix 
>> env. For example ${env.M2_HOME} returns the Maven2 installation path).
>>
>>     
>
> Has anyone actually been able to get this working? All of the filtering
> works fine for me, but the environment variable stuff does not.  As a test I
> have a properties file that contains:
> ${env.JAVA_HOME}
> ${user.home}
> ${pom.version}
>
> After the process-resources phase (with filtering turn on in the pom), the
> file looks like this:
> ${env.JAVA_HOME}
> /home/build
> 1.2-SNAPSHOT
>
> JAVA_HOME is definitely set, is there something I am doing wrong, or does
> this just not work?
>
> Regards
> Gareth
>
>
>
>
> Hi Andreas!
>
> Take a look at the Getting Started Guide 
> (http://maven.apache.org/guides/getting-started/index.html), section 
> "How do I filter resource files?". It explains how to reference the 
> elements of the pom.xml/settings.xml using property-names.
>
> I´m currently working on a book that covers Maven 2 as part of a 
> pragmatic configuration management process and have done some "research" 
> concerning the usage of properties. AFAIK, properties are resolved in 
> the following order:
>
> - The (hard-coded) property ${basedir} (contains the path of the POM-file)
> - All Java System Properties defined by the JVM.
> - All properties defined in the properties-element of the POM.
> - All elements in pom.xml and settings.xml as stated above
> - All (platform-specific) Environment variables (Just add the prefix 
> env. For example ${env.M2_HOME} returns the Maven2 installation path).
>
> I´m not 100% sure about the list and appreciate any additions/corrections.
>
> CU,
>
> Gunther
>
> ---------------------------------------------------------------------
> 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: Properties/Variables in pom?

Posted by Gareth Tilley <ga...@rmb.co.za>.
Hi All,


Gunther Popp-2 wrote:
> 
> - All (platform-specific) Environment variables (Just add the prefix 
> env. For example ${env.M2_HOME} returns the Maven2 installation path).
> 

Has anyone actually been able to get this working? All of the filtering
works fine for me, but the environment variable stuff does not.  As a test I
have a properties file that contains:
${env.JAVA_HOME}
${user.home}
${pom.version}

After the process-resources phase (with filtering turn on in the pom), the
file looks like this:
${env.JAVA_HOME}
/home/build
1.2-SNAPSHOT

JAVA_HOME is definitely set, is there something I am doing wrong, or does
this just not work?

Regards
Gareth




Hi Andreas!

Take a look at the Getting Started Guide 
(http://maven.apache.org/guides/getting-started/index.html), section 
"How do I filter resource files?". It explains how to reference the 
elements of the pom.xml/settings.xml using property-names.

I´m currently working on a book that covers Maven 2 as part of a 
pragmatic configuration management process and have done some "research" 
concerning the usage of properties. AFAIK, properties are resolved in 
the following order:

- The (hard-coded) property ${basedir} (contains the path of the POM-file)
- All Java System Properties defined by the JVM.
- All properties defined in the properties-element of the POM.
- All elements in pom.xml and settings.xml as stated above
- All (platform-specific) Environment variables (Just add the prefix 
env. For example ${env.M2_HOME} returns the Maven2 installation path).

I´m not 100% sure about the list and appreciate any additions/corrections.

CU,

Gunther

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




-- 
View this message in context: http://www.nabble.com/Variables-in-pom--tf1290889s177.html#a7235831
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: Properties/Variables in pom?

Posted by an...@nokia.com.
Hi Gunther, 

>-----Original Message-----
>From: ext Gunther Popp [mailto:svnuserlist@guntherpopp.de] 

>Take a look at the Getting Started Guide 
>(http://maven.apache.org/guides/getting-started/index.html), 
>section "How do I filter resource files?". It explains how to 
>reference the elements of the pom.xml/settings.xml using 
>property-names.

I've already read that section before, but I don't consider these two sentences explaining:

First, it's mentioned at the wrong place (when I'm looking for available properties, I would go the the POM references, I think. But not where I filter resource files. 

Second:
"To accomplish this in Maven, put a reference to the property that will contain the value into your resource file using the syntax ${<property name>}. The property can be one of the values defined in your pom.xml, a value defined in the user's settings.xml, a property defined in an external properties file, or a system property."

Leaves a couple of questions: 
* What's the syntax of <property name>? Apparently some dot-separated grammar. 
* Does that apply to all elements in the POM? If yes, how are multiple children with the same name addressed? 

>- The (hard-coded) property ${basedir} (contains the path of 
>the POM-file)
>- All Java System Properties defined by the JVM.
>- All properties defined in the properties-element of the POM.
>- All elements in pom.xml and settings.xml as stated above
>- All (platform-specific) Environment variables (Just add the 
>prefix env. For example ${env.M2_HOME} returns the Maven2 
>installation path).
>
>I´m not 100% sure about the list and appreciate any 
>additions/corrections.

A great list so far, thanks!

 _         __                _  _
//\ndreas.[|-bbert-[]/arroum(a)[|\|okia.com
           `-        `
   Andreas Ebbert-Karroum
   Software Design Engineer - Nokia Networks Services / Middleware 
   phone: +49-211-94123928, fax: +49-211-9412-3838
   Heltorfer Straße 1, 40472 Düsseldorf, Germany 

----------------------------------------------------------------------
This message is confidential. If you have received this message in error,
please delete it from your system. You should not copy it for any purpose,
or disclose its contents to any other person. Internet communications are
not secure and therefore Nokia GmbH does not accept legal responsibility
for the contents of this message as it has been transmitted over a public
network. Thank you.
Nokia GmbH, Nokia Networks is a German Company. Further information
about the Company is available from its principal offices at
Heltorferstrasse 1, D-40472, Düsseldorf, Germany and from the
website at http://www.nokia.com/
----------------------------------------------------------------------

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


Re: Properties/Variables in pom?

Posted by Gunther Popp <sv...@guntherpopp.de>.
Hi Andreas!

Take a look at the Getting Started Guide 
(http://maven.apache.org/guides/getting-started/index.html), section 
"How do I filter resource files?". It explains how to reference the 
elements of the pom.xml/settings.xml using property-names.

I´m currently working on a book that covers Maven 2 as part of a 
pragmatic configuration management process and have done some "research" 
concerning the usage of properties. AFAIK, properties are resolved in 
the following order:

- The (hard-coded) property ${basedir} (contains the path of the POM-file)
- All Java System Properties defined by the JVM.
- All properties defined in the properties-element of the POM.
- All elements in pom.xml and settings.xml as stated above
- All (platform-specific) Environment variables (Just add the prefix 
env. For example ${env.M2_HOME} returns the Maven2 installation path).

I´m not 100% sure about the list and appreciate any additions/corrections.

CU,

Gunther

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


RE: Properties/Variables in pom?

Posted by an...@nokia.com.
Hi Dan, 

>-----Original Message-----
>From: ext dan tran [mailto:dantran@gmail.com] 
>Sent: 17 March, 2006 20:03

>You can use the pom itself, ie ${project.build.directory}
>
>-D

Sorry, I don't understand, what you're trying to tell me :-) Can you please add one or two sentences :-) Is ${project.build.directory} one variable or can I somehow look the others up by using that?

 _         __                _  _
//\ndreas.[|-bbert-[]/arroum(a)[|\|okia.com
           `-        `
   Andreas Ebbert-Karroum
   Software Design Engineer - Nokia Networks Services / Middleware 
   phone: +49-211-94123928, fax: +49-211-9412-3838
   Heltorfer Straße 1, 40472 Düsseldorf, Germany 

----------------------------------------------------------------------
This message is confidential. If you have received this message in error,
please delete it from your system. You should not copy it for any purpose,
or disclose its contents to any other person. Internet communications are
not secure and therefore Nokia GmbH does not accept legal responsibility
for the contents of this message as it has been transmitted over a public
network. Thank you.
Nokia GmbH, Nokia Networks is a German Company. Further information
about the Company is available from its principal offices at
Heltorferstrasse 1, D-40472, Düsseldorf, Germany and from the
website at http://www.nokia.com/
----------------------------------------------------------------------

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


Re: Properties/Variables in pom?

Posted by dan tran <da...@gmail.com>.
You can use the pom itself, ie ${project.build.directory}

-D


On 3/17/06, andreas.ebbert-karroum@nokia.com <
andreas.ebbert-karroum@nokia.com> wrote:
>
> Hi,
>
> Are the default properties documented at all somewhere?
>
> _         __                _  _
> //\ndreas.[|-bbert-[]/arroum(a)[|\|okia.com
>           `-        `
>   Andreas Ebbert-Karroum
> Software Design Engineer - Nokia Networks Services / Middleware
> phone: +49-211-94123928, fax: +49-211-9412-3838
> Heltorfer Straße 1, 40472 Düsseldorf, Germany
>
> ----------------------------------------------------------------------
> This message is confidential. If you have received this message in error,
> please delete it from your system. You should not copy it for any purpose,
> or disclose its contents to any other person. Internet communications are
> not secure and therefore Nokia GmbH does not accept legal responsibility
> for the contents of this message as it has been transmitted over a public
> network. Thank you.
> Nokia GmbH, Nokia Networks is a German Company. Further information
> about the Company is available from its principal offices at
> Heltorferstrasse 1, D-40472, Düsseldorf, Germany and from the
> website at http://www.nokia.com/
> ----------------------------------------------------------------------
>
> >-----Original Message-----
> >From: ext
> >users-return-42636-andreas.ebbert-karroum=nokia.com@maven.apach
> >e.org
> >[mailto:users-return-42636-andreas.ebbert-karroum=nokia.com@mav
> >en.apache.org]
> >Sent: 16 March, 2006 12:40
> >To: users@maven.apache.org
> >Subject: Variables in pom?
> >
> >Hi,
> >
> >where are the variables documented, that I can use inside the
> >POM? I guess there's something available like ${artifactId}
> >and alike, but I couldn't find a place, where they're all
> >listed and described.
> >
> >Andreas Ebbert-Karroum
> >  Software Design Engineer - Nokia Networks Services / Middleware
> >  phone: +49-211-94123928, fax: +49-211-94123838
> >  Heltorfer Straße 1, 40472 Düsseldorf, Germany
> >
> >
> >________________________________
> >
> >This message is confidential. If you have received this
> >message in error, please delete it from your system. You
> >should not copy it for any purpose, or disclose its contents
> >to any other person. Internet communications are not secure
> >and therefore Nokia GmbH does not accept legal responsibility
> >for the contents of this message as it has been transmitted
> >over a public network. Thank you.
> >
> >Nokia GmbH, Nokia Networks is a German Company. Further
> >information about the Company is available from its principal
> >offices at Heltorferstrasse 1, D-40472, Düsseldorf, Germany
> >and from the website at http://www.nokia.com/
> >________________________________
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: Properties/Variables in pom?

Posted by an...@nokia.com.
Hi Wayne,

>-----Original Message-----
>From: ext Wayne Fay [mailto:waynefay@gmail.com] 
>Sent: 17 March, 2006 20:06

>Short answer: not anywhere that I've seen.
>
>If you do some research and get a list, feel free to respond 
>back to the mailing list, update the Wiki/Confluence, etc.

ok I'll come back, when I found something :-) 

 _         __                _  _
//\ndreas.[|-bbert-[]/arroum(a)[|\|okia.com
           `-        `
   Andreas Ebbert-Karroum
   Software Design Engineer - Nokia Networks Services / Middleware 
   phone: +49-211-94123928, fax: +49-211-9412-3838
   Heltorfer Straße 1, 40472 Düsseldorf, Germany 

----------------------------------------------------------------------
This message is confidential. If you have received this message in error,
please delete it from your system. You should not copy it for any purpose,
or disclose its contents to any other person. Internet communications are
not secure and therefore Nokia GmbH does not accept legal responsibility
for the contents of this message as it has been transmitted over a public
network. Thank you.
Nokia GmbH, Nokia Networks is a German Company. Further information
about the Company is available from its principal offices at
Heltorferstrasse 1, D-40472, Düsseldorf, Germany and from the
website at http://www.nokia.com/
----------------------------------------------------------------------

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


Re: Properties/Variables in pom?

Posted by Wayne Fay <wa...@gmail.com>.
> Are the default properties documented at all somewhere?

Short answer: not anywhere that I've seen.

If you do some research and get a list, feel free to respond back to
the mailing list, update the Wiki/Confluence, etc.

Wayne