title: Java / Gradle - building a .jar file from .class files
body: <p>I'm a newbie to Gradle. I'm tasked with writing a Gradle script / task that takes a bunch of precompiled .class and .properties files in a given directory (and all subdirectories thereof) and creating a single .jar file from them, manifest and all. </p>
  
  <p>For example, if I were using Ant .xml script, I might do something like the following:</p>
  
  <pre><code>&lt;target name="test" description="Build test.jar"&gt;
      &lt;exec dir="${testdir}" executable="cmd.exe " os="Windows 10"&gt;
          &lt;arg line="/c mkdir lib" /&gt;
      &lt;/exec&gt;
      &lt;jar destfile="${libdir}/test.jar"&gt;
          &lt;fileset dir="${testdir}/classes"&gt;
              &lt;include name="**/*.class" /&gt;
              &lt;include name="**/*.properties" /&gt;
          &lt;/fileset&gt;
      &lt;/jar&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>But I have no idea how to do something similar in Gradle. Would appreciate any help.</p>
  
  <p>Edit: Running Gradle v.2.14.1, Groovy v.2.4.4</p>