Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create Java gradle project

Tags:

java

gradle

How to create Java Gradle project from command line?

It should create standard maven folder layout like on the picture below.

Java Gradle created with Eclipse plugin

UPDATE:

.1. From http://www.gradle.org/docs/current/userguide/tutorial_java_projects.html I need to create file build.gradle with 2 lines

apply plugin: 'java' apply plugin: 'eclipse' 

.2. Add to build.gradle task below, than execute gradle create-dirs

task "create-dirs" << {    sourceSets*.java.srcDirs*.each { it.mkdirs() }    sourceSets*.resources.srcDirs*.each { it.mkdirs() } } 

.3. Then run gradle eclipse (or corresponding string to other IDE plugin configured)

So is there way to do it in one command?

like image 905
Paul Verest Avatar asked Dec 24 '12 05:12

Paul Verest


People also ask

What is Java Gradle project?

June 2020) Gradle is a build automation tool for multi-language software development. It controls the development process in the tasks of compilation and packaging to testing, deployment, and publishing. Supported languages include Java (as well as Kotlin, Groovy, Scala), C/C++, and JavaScript.


2 Answers

To create a Java project: create a new project directory, jump into it and execute

gradle init --type java-library 

Source folders and a Gradle build file (including a wrapper) will be build.

like image 112
Mike Avatar answered Oct 18 '22 18:10

Mike


The gradle guys are doing their best to solve all (y)our problems ;-). They recently (since 1.9) added a new feature (incubating): the "build init" plugin.

See: build init plugin documentation

like image 39
roomsg Avatar answered Oct 18 '22 20:10

roomsg