You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by vi...@wipro.com on 2005/05/05 14:16:31 UTC

Maven - IF Tag problem

Hi All....



Problem Statement:

The condition in the IF tag does not validate correctly, when any
variable retrieved from the property file is being used in the
condition.

We tried to retrieve a variable from the property file
<<build.properties>> and assign it to another variable so that it can be
used in the IF tag for validation.

The IF tag returns 'True' in false condition and vice versa.



The maven.xml contains the following code:



<project default="a" xmlns:j="jelly:core">



            <goal name="a">                      

                        <j:set var="a" value="${c}"/>


                        <j:if test="${a == 'yes'}">


                                    <echo message="Success"/>    

                        </j:if>                           

            </goal>

</project>        



The build.properties file contains a name value pair



c=yes



Actual Output:



__  __

|  \/  |__ _Apache__ ___

| |\/| / _` \ V / -_) ' \  ~ intelligent projects ~

|_|  |_\__,_|\_/\___|_||_|  v. 1.0.2



BUILD SUCCESSFUL

Total time: 1 seconds

Finished at: Thu May 05 17:15:50 IST 2005



Expected Output:



__  __

|  \/  |__ _Apache__ ___

| |\/| / _` \ V / -_) ' \  ~ intelligent projects ~

|_|  |_\__,_|\_/\___|_||_|  v. 1.0.2



build:start:



a:

    [echo] Success

BUILD SUCCESSFUL

Total time: 2 seconds

Finished at: Thu May 05 17:18:29 IST 2005



Question:

Please provide some clue to solve this problem







Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.

RE: Maven - IF Tag problem

Posted by Vincent Siveton <vi...@gmail.com>.
Hi,

For me its not an issue. 
Let s try to define the variable a as a String:
<j:set var="a">${c}</j:set>

Cheers,

Vincent

> -----Original Message-----
> From: vijayakumar.lakshmanan@wipro.com
> [mailto:vijayakumar.lakshmanan@wipro.com]
> Sent: Thursday, May 05, 2005 8:17 AM
> To: users@maven.apache.org
> Subject: Maven - IF Tag problem
> 
> 
> Hi All....
> 
> 
> 
> 
> Problem Statement:
> 
> The condition in the IF tag does not validate correctly, when any
> variable retrieved from the property file is being used in the
> condition.
> 
> We tried to retrieve a variable from the property file
> <<build.properties>> and assign it to another variable so that it can be
> used in the IF tag for validation.
> 
> The IF tag returns 'True' in false condition and vice versa.
> 
> 
> 
> 
> The maven.xml contains the following code:
> 
> 
> 
> 
> 
> <project default="a" xmlns:j="jelly:core">
> 
> 
> 
> 
>             <goal name="a">
> 
> 
>                         <j:set var="a" value="${c}"/>
> 
> 
>                         <j:if test="${a == 'yes'}">
> 
> 
>                                     <echo message="Success"/>
> 
> 
>                         </j:if>
> 
> 
>             </goal>
> 
> </project>
> 
> 
> 
> 
> 
> The build.properties file contains a name value pair
> 
> 
> 
> 
> c=yes
> 
> 
> 
> 
> Actual Output:
> 
> 
> 
> 
> __  __
> 
> |  \/  |__ _Apache__ ___
> 
> | |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
> 
> |_|  |_\__,_|\_/\___|_||_|  v. 1.0.2
> 
> 
> 
> 
> BUILD SUCCESSFUL
> 
> Total time: 1 seconds
> 
> Finished at: Thu May 05 17:15:50 IST 2005
> 
> 
> 
> 
> Expected Output:
> 
> 
> 
> 
> __  __
> 
> |  \/  |__ _Apache__ ___
> 
> | |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
> 
> |_|  |_\__,_|\_/\___|_||_|  v. 1.0.2
> 
> 
> 
> 
> build:start:
> 
> 
> 
> 
> a:
> 
>     [echo] Success
> 
> BUILD SUCCESSFUL
> 
> Total time: 2 seconds
> 
> Finished at: Thu May 05 17:18:29 IST 2005
> 
> 
> 
> 
> Question:
> 
> Please provide some clue to solve this problem
> 
> 
> 
> 
> 
> 
> 
> 
> Confidentiality Notice
> 
> 
> The information contained in this electronic message and any attachments
> to this message are intended
> for the exclusive use of the addressee(s) and may contain confidential or
> privileged information. If
> you are not the intended recipient, please notify the sender at Wipro or
> Mailadmin@wipro.com immediately
> and destroy all copies of this message and any attachments.


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