Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ant execute a command

Tags:

exec

ant

I use Silk4J and in my build, I have to start the agent. The command I use is:

<exec spawn="true" executable="${env.OPEN_AGENT_HOME}/agent/openAgent.exe" />

It gives me this error

The ' characters around the executable and arguments are not part of the command. 

Do I need to change it?

like image 710
Guylene Emond Avatar asked Oct 22 '13 18:10

Guylene Emond


People also ask

How do you run Ant commands?

To run the ant build file, open up command prompt and navigate to the folder, where the build. xml resides, and then type ant info. You could also type ant instead. Both will work,because info is the default target in the build file.

What is Ant command in Linux?

It is the most complete Java build and deployment tool available. It is platform neutral and can handle platform specific properties, such as file separators. It can be used to perform platform specific tasks such as modifying the modified time of a file using 'touch' command. Ant scripts are written using plain XML.


Video Answer


2 Answers

It is good practice to wrap logged entries in single quotes so that if an entry is empty you can still see it, for example:

No password for user ''

Otherwise you would see:

No password for user

which is misleading. In this case it only informs you that the quotes are only there for this reason and not part of the logged data. I think the sentence is slightly confusing because of the negative form 'are not part of the command' which looks like there is a problem...

like image 37
Christophe Roussy Avatar answered Oct 19 '22 09:10

Christophe Roussy


The message doesn't signify an error.

When the -v, -verbose, -d, or -debug option is given to Ant, the <exec> task outputs the command it is executing along with the message:

 [exec] Current OS is Windows 7
 [exec] Executing 'cmd' with arguments:
 [exec] '/c'
 [exec] '@for %a in (C:\src\ant\ant-dir-file-local) do @echo %~ta'
 [exec]
 [exec] The ' characters around the executable and arguments are
 [exec] not part of the command.
 [exec] 10/23/2013 02:36 AM

Breaking down the above example...

 [exec] Executing 'cmd' with arguments:
                  ^   ^ 
 [exec] '/c'
        ^  ^
 [exec] '@for %a in (C:\src\ant\ant-dir-file-local) do @echo %~ta'
        ^                                                        ^

In this case, the single quotes (') above each ^ aren't part of the command. Ant wraps the executable name and each argument with single quotes to make it clear what is part of the command and what isn't. Ant does this to help users debug their Ant scripts when <exec> doesn't behave as expected. The message is purely informational.

like image 104
Chad Nouis Avatar answered Oct 19 '22 08:10

Chad Nouis