Android Studio - Create JAR file with dependencies for standard Java project
<p>I'm building a standard java project, not an android project.</p>

<p>It is using the Gson library from Google.
Is there a way to create a JAR file for this project, while maintaining dependencies to the Gson library? Please correct me if I'm framing the question wrong.</p>

<p>The build.gradle for my module looks like this:</p>

<pre><code>apply plugin: 'java'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile  'com.google.code.gson:gson:2.3'
}
</code></pre>

<p>I used the instructions <a href="http://dominoc925.blogspot.ca/2015/09/how-to-create-and-use-jar-archive-using.html" rel="nofollow">here</a> to create a JAR file but when I run it from the command line using "java -jar myproject.jar" I get this error:</p>

<blockquote>
  <p>no main manifest attribute, in myproject.jar</p>
</blockquote>

<p>I tried looking for a solution and it seems there isn't a way to create a JAR file with dependencies, although the link above is pretty new. Seems that I have to make an AAR file in this case.</p>

<p>But since mine is a java project rather than android does this still apply?</p>

<p>Thanks.</p>

<p><strong>EDIT</strong>:
According to this <a href="https://www.youtube.com/watch?v=BZwsk42fOZU" rel="nofollow">video</a> my Manifest.MF file is missing the line "Main-Class:MyMainClassName".
Modifying the file from the JAR corrupts it. And I can't edit the manifest file from within android studio. And idea on how I can change this?</p>