Eclipse Gradle 配置
来源:互联网 发布:北京哪个java培训班好 编辑:程序博客网 时间:2024/06/02 07:13
一、Gradle简介
Gradle 是以 Groovy 语言为基础,面向Java应用为主。基于DSL(领域特定语言)语法的自动化构建工具。
二、配置步骤如下:
1、资源下载:
Grandle官网下载Gradle,地址:http://www.gradle.org/downloads
提示:如果只是运行可以只下载bin,为了扩展开发还是下载all。
2、下载完毕后,解压zip至安装目录即可,例如:D:\Program Files
3、设置环境变量,需要设置如下2个环境变量
1、添加GRADLE_HOME指向gradle的安装目录的根目录
GRADLE_HOME=D:\Program Files\gradle-2.0
2、Path变量添加gradle的bin目录
D:\Program Files\gradle-2.0\bin
4、以上步骤设置完毕,打开cmd,运行gradle -v看到gradle的版本信息,配置完成。
5.打开Eclipse,Help-->Install new software,输入http://dist.springsource.com/release/TOOLS/gradle
如果提示找不到地址,估计是被墙掉了,需要FQ。如果找得到地址,选择安装项,然后一直下一步,直到安装完毕,重启Eclipse即可。
6.创建一个web项目,在根目录下创建一个build.gradle文件
build.gradle文件内容如下:
apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
sourceCompatibility = 1.8 // 设置 JDK 版本
webAppDirName = 'WebContent' // 设置 WebApp 根目录
sourceSets.main.java.srcDir 'src' // 设置 Java 源码所在目录
// 设置 maven 库地址
repositories {
mavenCentral() // 中央库
maven { url 'http://localhost:8081/nexus/content/groups/public' } // 自定义库地址
}
// 设置依赖
dependencies {
providedCompile 'javax.servlet:servlet-api:2.5' // 编译期
providedRuntime 'javax.servlet:jstl:1.2' // 运行时
}
// 设置 Project Facets
eclipse {
wtp {
facet {
facet name: 'jst.web', type: Facet.FacetType.fixed
facet name: 'wst.jsdt.web', type: Facet.FacetType.fixed
facet name: 'jst.java', type: Facet.FacetType.fixed
facet name: 'jst.web', version: '2.5'
facet name: 'jst.java', version: '1.8'
facet name: 'wst.jsdt.web', version: '1.0'
}
}
}
提示:项目有个G,正常情况下是没有的,需要右键项目 "Configure->Convert to Gradle Project..",稍等下就OK了,就能像我有这个图标G,
添加依赖包:需要右键项目"Gradle->Refresh All","Gradle->Dependency->Management".
8、可能报错
Unable to start the daemon process.This problem might be caused by incorrect configuration of the daemon.For example, an unrecognized jvm option is used.Please refer to the user guide chapter on the daemon at http://gradle.org/docs/2.2.1/userguide/gradle_daemon.htmlPlease read the following process output to find out more:-----------------------Error occurred during initialization of VMCould not reserve enough space for object heapError: Could not create the Java Virtual Machine.Error: A fatal exception has occurred. Program will exit.Could not fetch model of type 'HierarchicalEclipseProject' using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.2.1-bin.zip'.
1、定位到目录 C:\Users\<username>\.gradle 2、创建文件gradle.properties 内容:org.gradle.jvmargs=-Xmx512m 3、重启你的Android Studio项目,即可。
9、设置gradle下jar包的保存地址, "window->preferences->gradle",如下:
转自:http://www.cnblogs.com/274914765qq/p/4401525.html
- eclipse下gradle配置
- eclipse下gradle配置
- eclipse下gradle配置
- Eclipse配置Gradle插件
- eclipse gradle插件配置
- eclipse下gradle配置
- eclipse下gradle配置
- eclipse下gradle配置
- eclipse配置gradle
- eclipse下gradle配置
- mac+eclipse+gradle 配置
- Eclipse Gradle配置
- Eclipse + Gradle环境配置
- Eclipse Gradle 配置
- gradle插件配置-eclipse
- Eclipse使用gradle的配置
- Eclipse下gradle的配置
- Eclipse中安装配置Gradle
- Django教程之一-----Django一瞥
- 酒店价格、集合、文件名称
- Python单进程的方式实现多任务模式
- 让Hive支持行级insert、update、delete
- ubuntu下,PX4 System Console 系统控制台的连接方法
- Eclipse Gradle 配置
- 网格计算和云计算之间的比较
- 从程序员到产品经理再到自己创业的心路历程
- 编译时注解
- 1024科学记数法(字符串处理)
- 简单介绍Hadoop
- 单调栈的运用 by Lucas Yang
- UVA1220[Party at Hali-Bula] 树上动态规划
- MySql 错误编号及解决方法收集