title: Add password to package in gradle
body: <p>I packed a zip containing a list of webapps with gradle.</p>
  
  <p>At the end, I would like to add a password to the zip.</p>
  
  <p>I tried to user commandLine passing the linuz command "zipcloak", then the psw in required twice and I'm not able to send it to the command line: </p>
  
  <pre><code>commandLine ("zipcloak", zip_name + ".zip")
  setStandardInput ("psw")
  setStandardInput ("psw")
  </code></pre>
  
  <p>Maybe there is a better solution to do this...</p>
  
  <p>Thanks</p>
  
  <p>EDIT:</p>
  
  <p>I progressed by adding this lines:</p>
  
  <pre><code>commandLine "zipcloak", "zipname.zip"
  ByteArrayOutputStream bytes = new ByteArrayOutputStream()
  PrintWriter out = new PrintWriter(bytes)
  out.println("psw")
  out.println("psw")
  out.flush()
  ByteArrayInputStream input = new ByteArrayInputStream(bytes.toByteArray())
  standardInput = input
  </code></pre>
  
  <p>Now the command is executed and I see on the console the request of the password, but I'm not still able to send a string to this request directly from the script, I have to add it manually on the console...</p>
  
  <p>EDIT - SOLUTION FOUND:</p>
  
  <p>I found the solution: instead of adding a password to an existing zip, I packed the zip WITH password</p>
  
  <pre><code>task encodeZip(type: Exec) {
      workingDir path_target_workspace
      commandLine "zip", "-P", "password", "-r", "zipname.zip", "file1", "file2", "fil3" .....
  }
  </code></pre>
  
  <p>Hope it helps</p>