Gradle Basic

Gradle

Gradle is build tool for Java.
AndroidStudio uses gradle by default.
It is powerful build

Other refs

Spring Boot Gradle

Basic Project

build file name is build.gradle

First Gradle

mkdir hello
cd hello

Prepare build.gradle

task hello << {
  println 'Hello World!'
}

Run gradle

gradle hello

Java Project

Ref : Gradleで始めるJavaプロジェクトとEclipseのプラグイン

mkdir java_project
cd java_project
gradle init --type java-library

Finally, we made following files

.gradle
gradle
gradlew
gradlew.bat
settings.gradle
src
src/test/java
src/main/java/Library.java

build

gradle build

See gradle tasks

gradle tasks

Dependency library

How to add
Example

dependencies {
	compile ('org.springframework.boot:spring-boot-starter:1.2.5.RELEASE')
	compile ('org.springframework.boot:spring-boot-configuration-processor:1.2.5.RELEASE')
	compile ('org.springframework:spring-core:4.1.7.RELEASE')
	compile ('org.springframework:spring-jdbc:4.1.7.RELEASE')
	compile ('org.springframework:spring-web:4.1.7.RELEASE')
	compile ('org.mybatis:mybatis:3.2.8')
	compile ('org.mybatis:mybatis-spring:1.2.2')
	compile ('commons-pool:commons-pool:1.6')
	compile ('org.codehaus.janino:janino:2.7.8')
	compile ("mysql:mysql-connector-java:5.1.13")
}

We need to find library

Eclipse

You can import gradle project you made above as Gradle Project
Please install gradle plugin for Eclipse

Create Eclipse Project

Add following to your gradle file

apply plugin: 'eclipse'

Run following command

gradle eclipse

You can import project as Java Project

Ref

Tasks : Gradle