You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2006/10/12 17:21:19 UTC
DO NOT REPLY [Bug 40742] New: - Tag "isset" does not recognise property set with argument "-D"
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40742>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40742
Summary: Tag "isset" does not recognise property set with
argument "-D"
Product: Ant
Version: 1.7.0Beta2
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: Build Process
AssignedTo: dev@ant.apache.org
ReportedBy: opyate@gmail.com
CC: opyate@gmail.com
Tag "isset" does not recognise property set with argument "-D"
When running Ant, on the command line I would like to specify a property:
> ant -Dtest.class.name=class.to.be.Tested
Then, in the build file I would like to test if this property has been set,
otherwise default to something else:
<?xml version="1.0" encoding="UTF-8"?>
<project default="default-task-name" basedir="." name="project-name">
<condition property="testClassSpecified">
<isset property="test.class.name"/>
</condition>
<if>
<equals arg1="testClassSpecified" arg2="true" />
<then>
<echo message="Test class specified." />
</then>
<else>
<echo message="Test class not specified. Setting it to default Suite..." />
<property name="test.class.name" value="some.default.Suite"/>
</else>
</if>
<!-- tasks follow... -->
</project>
Maybe I'm doing something wrong, but Ant does not seem to pick up the argument,
and the condition always fails (i.e. "test.class.name" always defaults to
"some.default.Suite", and the rest of the tasks then execute perfectly with this
value.)
Other tools used with Ant:
* ant-contrib-1.0b2 (of which the JAR is in %ANT_HOME%/lib
* JUnit4.1 (of which the JAR is in %ANT_HOME%/lib
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 40742] - Tag "isset" does not recognise property set with argument "-D"
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40742>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40742
gudnabrsam@yahoo.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
------- Additional Comments From gudnabrsam@yahoo.com 2006-10-12 08:28 -------
uh, well, for one thing you didn't use property expansion notation in your
<equals> comparison; e.g. <equals arg1="${testClassSpecified}" arg2="true" />
2. If you are wanting to compare a property to true, you could use
<istrue value="${testClassSpecified}" />
3. All that is unnecessary, is if test.class.name is specified via -D, any
subsequent attempt to modify it will silently fail. So you can include
<property name="test.class.name" value="some.default.Suite" /> in your buildfile
and override via -D without fear. You should have brought your questions to the
userlist before submitting a bug report.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org