title: Gradle custom task for jar
body: <p>I am using Gradle for my Java project and I was wondering if it's possible to prevent <code>gradle build</code> from creating a jar file each time executed. <br></p>
  
  <p>Also, is it possible to have a custom task for creating the Jar with dependencies at a specific location <code>build/myAppJar/</code>.</p>
  
  <p>Here's what I have so far for the custom task:</p>
  
  <pre><code>task toJar (type: Jar) {
      from configurations.compile.collect { zipTree it }
      manifest {
          attributes 'Implementation-Title': 'myApp',
                  'Implementation-Version': 1.0,
                  'Main-Class': mainClassName
      }
  }
  </code></pre>
  
  <p>The above code will create the jar file under <code>build/libs</code>, and the file does not contain the compiled files, only the dependencies. </p>
  
  <p>Thank you!</p>