How to create a gradle-based Java Project in Intellij IDEA 13.0.1 Community

JavaIntellij IdeaGradle

Java Problem Overview


I want to start a empty project with Gradle in Intellij IDEA but it seems not so convenient as Eclipse does.

What I did is File->New Project->Gradle. And a project shows up but it's not completed (it has no src folder for example).

And I add apply plugin 'idea' in the build.gradle. When I refer to the All tasks in IntelliJ IDEA. There are no idea,cleanIdea,ideaProject for me to set up a IntelliJ IDEA.

In Eclipse+Gradle plugin, just create a new gradle project and everything is ready.

I want to know how to do that in Intellij IDEA.

Thanks

Java Solutions


Solution 1 - Java

When creating new Gradle project, select "Create directories for empty content roots automatically".

New Gradle project wizard

New project will have those directories.

Gradle project structure

Solution 2 - Java

In latest IntelliJ IDEA Community Edition(2018.1), there's no Create directories for empty content roots automatically option available in New Project dialog. But we can go to Preferences...->Build, Execution, Deployment->Gradle and check the underlined option in the screenshot below.

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmacemersView Question on Stackoverflow
Solution 1 - JavakukidoView Answer on Stackoverflow
Solution 2 - JavaDYSView Answer on Stackoverflow