• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cannot run .bat from Ant

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try as I might, I cannot seem to get this to work. what am I doing wrong here?
<target name="create-user">
<if>
<equals arg1="is.windows" arg2="true" />
<then>
<exec dir="${jboss.home}/bin" failonerror="true" executable="cmd">
<arg value="/c" />
<arg value="add-user.bat" />
<arg value="-a" />
<arg value="username" />
<arg value="password" />
</exec>
</then>
</if>
</target>
 
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Does this work for you ?



If so, then try modifying it one element at a time to get to your desired executable.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the problem that you are seeing? I'd hate to give you all kinds of advice about the <if> task if that isn't the issue you are seeing. It would help if you posted the output for the build, or at least for the create-user target.

By the way, you do know that you don't need to use the Ant-contrib <if> task to accomplish your goal, right? That you can do the same using the "if" and "unless" attributes of <target>?
 
Rebecca Carpenter
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not seeing any errors from running the ant script. It completes successfully. But it does not add the user to the realm.
When I try add-user.bat -a username password from the command line it works as expected. If I try the following, it works fine.
<target name="help">
<exec executable="cmd">
<arg value="/c"/>
<arg value="ant.bat"/>
<arg value="-p"/>
</exec>
</target>
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you seeing any output at all? It still would help if you posted the output for that target. You might also try running ant with the -v option and see if that provides more information. Posting that output would also help.

What I would do next is add some debugging to the add-user.bat script so that I could verify that it was running with the proper settings.
 
reply
    Bookmark Topic Watch Topic
  • New Topic