Java project with Gradle and building jar file in Intellij IDEA - how to? : <p>Is there anywhere a tutorial on how to create Java project with Gradle and then build the jar file?</p>

<p>I'm running into various problems with that. When I create Java project and then add Gradle with File -> New -> Module -> Gradle -> ... then I get some errors about Java EE websocket's not available (I'm using Ultimate Edition) but nevermind about that, I managed to create that project by selecting File -> New -> Project... -> Gradle -> ... and now I have my Java project with Gradle working properly (I can debug it in IDE) but when I try to create an artifact (jar file) I get various errors depending on how much I messed up in project structure settings...</p>

<pre><code>Buildfile: build.xml does not exist!
Build failed
</code></pre>

<p>or</p>

<pre><code>Error: Could not find or load main class Main
</code></pre>

<p>I think that this project is such a mess right now that the best solution would be to create another new project and just copy Main.class and Gradle's dependencies into this new project.</p>

<p>But how to make it properly?</p>
