Installation

Gradle runs on all major operating systems and requires only a Java JDK or JRE version 7 or higher to be installed. To check, run java -version:

$ java -version
java version "1.8.0_121"

Step 1. Download the latest Gradle distribution

download url : https://gradle.org/releases/ 
提供了二进制包和完整包(包含User Manual、API Javadoc、DSL Reference)

Step 2. Unpack the distribution

Create a new directory C:\Gradle with File Explorer.

Open a second File Explorer window and go to the directory where the Gradle distribution was downloaded. Double-click the ZIP archive to expose the content. Drag the content folder gradle-4.1 to your newly created C:\Gradle folder.

Alternatively(另外) you can unpack the Gradle distribution ZIP into C:\Gradle using an archiver tool of your choice.

Step 3. Configure your system environment

In File Explorer right-click on the This PC (or Computer) icon, then click Properties -> Advanced System Settings -> Environmental Variables.

Under System Variables select Path, then click Edit. Add an entry for C:\Gradle\gradle-4.1\bin. Click OK to save.

Step 4. Verify your installation

Open Windows command prompt and run gradle -v to run gradle and display the version, 
e.g.:

$ gradle -v
Gradle 4.1

注意:不同窗口下命令的执行 
dos: C:\Users\14009\Desktop\basic-demo>gradlew properties 
gitbash: $ ./gradlew properties

Building Java Applications

$ mkdir java-demo
$ cd java-demo
$ gradle init --type java-application

build.gradle 中添加 apply plugin: ‘idea’ 
执行命令 gradle idea 
用 IntelliJ IDEA打开就可以开始编码

Building Java Libraries

$ mkdir building-java-libraries
$ cd building-java-libraries
$ gradle init --type java-library

Building Java Web Applications

1.0  Create the structure of a web application

create the following file structure for a project called webdemo:

 Sample project layout
webdemo/
src/
main/
java/
webapp/
test
java/

2.0  Add a Gradle build file

Add a file called build.gradle to the root of the project, with the following contents:

build.gradle

plugins {
id 'java'
id 'war'
} repositories {
jcenter()
} dependencies {
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
testCompile 'junit:junit:4.12'
}

It is a good practice to generate a Gradle wrapper for the project by executing the wrapper task:

$ gradle wrapper --gradle-version=4.0

最新文章

  1. 4.添加对efcore的支持 ,并使用mysql数据库。
  2. PHP list,explode的使用
  3. ubuntu安装ssh
  4. yii 验证码的使用
  5. 《jQuery风暴》第2章 必须知道的JavaScript知识
  6. lnmp.org一键安装包
  7. listview加载图片显示
  8. Windows下的进程【一】
  9. c#查看电脑内存
  10. C#执行参数为游标 返回一个记录集的Oracle存储过程
  11. python面对对象编程----2:__init__
  12. ArcGIS网络分析之Silverlight客户端路径分析(三)
  13. 图解CSS选择器之nth家族
  14. 在C#中winform程序中应用nlog日志工具
  15. 数据结构与算法 —— 链表linked list(02)
  16. hdu1060 Leftmost Digit---求N的N次方的首位(对数)
  17. hdu 3433 A Task Process 二分+dp
  18. springMVC源码分析--ViewResolver视图解析器(一)
  19. linux服务器情况
  20. pyqt5 -——基本功能(HelloWorld)

热门文章

  1. 九度oj 1003 A+B 2010年浙江大学计算机及软件工程研究生机试真题
  2. LVS+keepalived DR模式配置高可用负载均衡集群
  3. awk中引用变量使用单引号''
  4. C# ASP.NET Core使用HttpClient的同步和异步请求
  5. SQL update 多表连接方法
  6. MySQL 5.7 解压版 安装教程(图文详细)[Windows]
  7. 互联网轻量级框架SSM-查缺补漏第七天(MyBatis的解析和运行原理)
  8. shell脚本报错 value too great for base
  9. jsp实现html页面静态化
  10. 第7章 征服CSS3选择器(下)