You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by James Leskovar <JL...@telecomsys.com> on 2014/06/02 01:29:36 UTC

sshexec difference in maven-antrun-plugin vs standalone Ant

Hi all,

I'm trying to understand what appears to be a difference in the output captured in the outputproperty attribute of the sshexec task, when the Ant script is called via maven-antrun-plugin vs being called by a stand-alone Ant installation.
I'm launching an external Ant script like so:
<plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.7</version>
        ...
            <configuration>
              <target>
                <ant antfile="build.xml" target="build" />
              </target>
            </configuration>
        ...
</plugin>

build.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<project>
  <target name="build">
    <antversion property="antversion"/>
    <echo>Using Ant v${antversion}</echo>
    <sshexec host="ansades51" username="emob" password="emob" trust="true" command="echo hello" outputproperty="ssh.cmd" />
    <echo>${ssh.cmd}</echo>
  </target>
</project>

When calling build.xml via Maven, the output I get is:
[INFO] --- maven-antrun-plugin:1.7:run (default) @ ant.test ---
[INFO] Executing tasks
main:
build:
     [echo] Using Ant v1.8.2
  [sshexec] Connecting to ansades51:22
  [sshexec] cmd : echo hello
hello
     [echo] echo hello : hello
[INFO] Executed tasks

When I call build.xml via ant on the command-line, the output I get instead is:
F:\DevTools\workspaces\MLC\ant.test>ant build
Buildfile: F:\DevTools\workspaces\MLC\ant.test\build.xml

build:
     [echo] Using Ant v1.8.2
  [sshexec] Connecting to ansades51:22
  [sshexec] cmd : echo hello
  [sshexec] hello
     [echo] hello

BUILD SUCCESSFUL
Total time: 1 second

Notice how the ${ssh.cmd} property in the Maven case appears to have the command prefixed with the output, whereas there is no such prefix in the standalone Ant case. Is this expected?
I'm actually calling a fairly large Ant script that uses sshexec with outputproperty in a bunch of places, and I'd much rather not have to change all of the sshexec calls to then have to grep out the command output.

Any help would be much appreciated,
Cheers,
James Leskovar
Software Engineer, Location Platforms
TeleCommunication Systems, Inc.

[ Address : TCS, iC Enterprise 1, Innovation Campus, Squires Way, Nth Wollongong, NSW, 2500, Australia ]
[ Tel : +61 2 4221 2940 ] [ Fax : +61 2 4221 2901 ]
[ Email : James.Leskovar@telecomsys.com<ma...@telecomsys.com> ]
[TCS]<http://www.telecomsys.com/default.aspx>[Facebook]<https://www.facebook.com/pages/TCS/340389379402958>[Twitter]<https://twitter.com/TeleComSys>[LinkedIn]<http://www.linkedin.com/company/telecommunication-systems>


CONFIDENTIALITY NOTICE: The information contained in this message may be privileged and/or confidential. If you are not the intended recipient, or responsible for delivering this message to the intended recipient, any review, forwarding, dissemination, distribution or copying of this communication or any attachment(s) is strictly prohibited. If you have received this message in error, please notify the sender immediately, and delete it and all attachments from your computer and network.