title: Include specific classes in jar archive in gradle build
body: <p>I have a newbie question on a gradle java project. I wish to configure the output artifact jar of this to only include certain classes from my project. I have the desired classes to be included in a file say <code>classes.txt</code> that is generated as a part of a separate task. How should one configure the <code>jar</code> task of the gradle build so that does this. This is what I have tried so far:</p>
  
  <pre><code>jar {
      // reset actions
      actions = []
      copy {
          def dependentClasses = file("classes.txt")
          if (dependentClasses.exists()) {
              dependentClasses.eachLine { include it }
          }
  
          from sourceSets.main.output
          includeEmptyDirs = false
          into "build/tmp/jar" //Some temporary location
      }
      // How to zip the contents?
  }
  </code></pre>
  
  <p>I am sorry for the possibly naive question, but I haven't had luck with the other solutions seen. </p>
  
  <p>Thanks!</p>