title: Executing a script from Maven 3 using exec plugin - gets blocked
body: <p>This is the situation I'm facing: at the moment I have two Maven projects, one that does nothing but describing dependencies, repositories, etc. (the parent) and a child which inherits the other's pom.xml. There'll be more modules to be created in the future, following the same model as the child.</p>
  
  <p>We decided to deploy the projects' sites (generated with maven-site-plugin) to a location accessible at this moment only via <strong>sftp</strong>. And I found it impossible to define the site location in <code>&lt;distributionManagement&gt;</code> because I couldn't integrate the sftp protocol (I tried using wagon-ssh-external).</p>
  
  <p>As a result, I've created a script that connects to the remote machine and uploads the contents of a local folder where our site is deployed during the <strong>site-deploy</strong> phase:</p>
  
  <pre><code>echo "Uploading the site.."
  lftp -u ${username},${password} sftp://${host} &lt;&lt;EOF
  mirror -R --delete-first $sitedir $remotedir
  echo "Exiting from lftp.."
  bye
  EOF
  echo "Terminating script execution.."
  </code></pre>
  
  <p>This works perfectly for the parent site, uploading the site right after it's created locally, but when the child gets at the end of the script, it doesn't finish properly, prints <code>Terminating script execution..</code> and stays there.</p>
  
  <p>I'm using Eclipse, the last version (3.7) with the default Maven plugin (v. 3.0.2). To generate and deploy the site in Eclipse, I've right-clicked the parent project > Run as > Maven build... > <code>parent clean site-deploy</code>. </p>
  
  <p>These are parts of the parent's <code>pom.xml</code>:</p>
  
  <pre><code>&lt;distributionManagement&gt;
   &lt;!-- Generate the site locally, then it'll be uploaded to the server --&gt;
   &lt;!-- Children will append their artifact ID to the base url  --&gt;
   &lt;site&gt;
    &lt;id&gt;project-name&lt;/id&gt;
    &lt;name&gt;Project Name&lt;/name&gt;
    &lt;url&gt;file://${env.HOME}/testsite/&lt;/url&gt;
   &lt;/site&gt;
  &lt;/distributionManagement&gt;
  ...
  &lt;build&gt; 
  &lt;pluginManagement&gt;
   &lt;plugins&gt;
    &lt;plugin&gt;
     &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
     &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
     &lt;version&gt;1.2.1&lt;/version&gt;
    &lt;/plugin&gt;
   &lt;/plugins&gt;
  &lt;/pluginManagement&gt;
  &lt;plugins&gt;
   &lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-site-plugin&lt;/artifactId&gt;
    &lt;version&gt;3.0&lt;/version&gt;
    &lt;configuration&gt;
      ...
   &lt;/plugin&gt;
   &lt;plugin&gt;
    &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;          
    &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
    &lt;inherited&gt;false&lt;/inherited&gt;
    &lt;executions&gt;
     &lt;execution&gt;
      &lt;id&gt;sh&lt;/id&gt;
      &lt;phase&gt;site-deploy&lt;/phase&gt;
      &lt;goals&gt;
       &lt;goal&gt;exec&lt;/goal&gt;
      &lt;/goals&gt;
      &lt;configuration&gt;
       &lt;executable&gt;sh&lt;/executable&gt;
       &lt;arguments&gt;
        &lt;argument&gt;publish-site.sh&lt;/argument&gt;
        &lt;argument&gt;${localsitedir}&lt;/argument&gt;
        ...
       &lt;/arguments&gt;
      &lt;/configuration&gt;
     &lt;/execution&gt;
    &lt;/executions&gt;
   &lt;/plugin&gt;
  &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>And from the child:</p>
  
  <pre><code>&lt;build&gt;
   &lt;plugin&gt;
    &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;          
    &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
    &lt;executions&gt;
     &lt;execution&gt;
      &lt;id&gt;sh&lt;/id&gt;
      &lt;phase&gt;site-deploy&lt;/phase&gt;          
      &lt;goals&gt;
       &lt;goal&gt;exec&lt;/goal&gt;
      &lt;/goals&gt;
      &lt;configuration&gt;
       &lt;executable&gt;sh&lt;/executable&gt;
       &lt;arguments&gt;
        &lt;argument&gt;../parent/publish-site.sh&lt;/argument&gt;
        &lt;argument&gt;${localsitedir}/child&lt;/argument&gt;
        ...
       &lt;/arguments&gt;
      &lt;/configuration&gt;
     &lt;/execution&gt;
    &lt;/executions&gt;
   &lt;/plugin&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>I've tried different ways to configure the <strong>exec</strong> plugin (without using <code>pluginManagement</code>, inheriting the parent's configuration of the plugin and only rewriting the arguments part, etc..) and it always gets blocked when finishing the script and doesn't end the execution.</p>
  
  <p>The site is uploaded correctly, but of course, I don't want to manually terminate the Maven build execution each time I want to update the site (also, it is planned to deploy artifacts from the project to a Jenkins server, so the site deployment hopefully would be working by then).</p>