Are not the boolean type value of true and false different from string
values of 'true' and 'false'.
That might explain why ${myProp != 'true'} evaluates as true in Russ
example.-----Original Message----- From: Russ Jubenville [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 09, 2005 1:43 PM To: Maven Users List Subject: RE: Question on accessing user-defined properties in maven.xml It seems to be a problem in using the == comparison. If you use the variable alone as the boolean expression, things seem to work: build.properties: myProp=true Maven.xml: ... <goal name="talkJellyToMe"> <echo>myProp is ${myProp}</echo> <j:if test="${myProp == 'true'}"> <echo>Yup, myProp is true!</echo> </j:if> <j:if test="${myProp != 'true'}"> <echo>Hmm, seems myProp is false!</echo> </j:if> <j:if test="${myProp}"> <echo>Yup, myProp is true if you don't use an == comparison!</echo> </j:if> </goal> ... Results: talkJellyToMe: [echo] myProp is true [echo] Hmm, seems myProp is false! [echo] Yup, myProp is true if you don't use an == comparison! -----Original Message----- From: Qian Su [mailto:[EMAIL PROTECTED] Sent: February 9, 2005 15:50 To: Maven Users List Subject: RE: Question on accessing user-defined properties in maven.xml Hi Russ, Thanks for the quick reply. I don't think I have the same property declared anywhere else. I believe it is a matter of correct syntax for accessing the value of a user defined property. Below is portion of my maven.xml file and the prints out for it: <echo>hibernate.doclet.xxx: ${hibernate.doclet.xxx}</echo> >> hibernate.doclet.xxx: true <j:if test="${hibernate.doclet.xxx != 'true'}"> ... </j:if> >> never gets inside the if statement. Can you please point it out to me as for how to access the value of ' hibernate.doclet.xxx' in the <j:if> tag using correct syntax? Thanks! Qian -----Original Message----- From: Russ Jubenville [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 09, 2005 12:41 PM To: Maven Users List Subject: RE: Question on accessing user-defined properties in maven.xml Do you perhaps have the same property defined with different values in multiple property files? Properties defined in project.properties get overridden by those in almost any other property file. (The only ones with lower priority are those in plug-ins). >From the user guide (http://maven.apache.org/reference/user-guide.html): The properties files in Maven are processed in the following order: * ${project.home}/project.properties * ${project.home}/build.properties * ${user.home}/build.properties Where the last definition wins. So, Maven moves through this sequence of properties files overridding any previously defined properties with newer definitions. In this sequence your ${user.home}/build.properties has the final say in the list of properties files processed. We will call the list of properties files that Maven processes the standard properties file set. In addition, System properties are processed after the above chain of properties files are processed. So, a property specified on the CLI using the -Dproperty=value convention will override any previous definition of that property. ..Russ Jubenville -----Original Message----- From: Qian Su [mailto:[EMAIL PROTECTED] Sent: February 9, 2005 15:32 To: [email protected] Cc: Qian Su Subject: Question on accessing user-defined properties in maven.xml Hi, I declared a property of my own in project.properties file, but failed to access the value of this property in maven.xml. Below is my sample code in project.properties and maven.xml: (project.properties) hibernate.doclet.generate=true (maven.xml) <j:if test="${systemScope['hibernate.doclet.generate'] == 'true'}"> ... </j:if> It seems that the property set in project.properties is not visible in maven.xml, however, if I run maven with -Dhibernate.doclet.generate=true, then the 'if' statement does evaluate to true. I tried to look for online resources to see how to access user-defined properties in maven.xml but failed. I would really appreciate any help here since it is a very commonly desired feature. Qian ######################################################################## ############# This e-mail message has been scanned for Viruses and Content and cleared by NetIQ MailMarshal ######################################################################## ############# ######################################################################## ############# This e-mail message has been scanned for Viruses and Content and cleared by NetIQ MailMarshal ######################################################################## ############# --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ######################################################################## ############# This e-mail message has been scanned for Viruses and Content and cleared by NetIQ MailMarshal ######################################################################## ############# ######################################################################## ############# This e-mail message has been scanned for Viruses and Content and cleared by NetIQ MailMarshal ######################################################################## ############# --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
