eclipse gradle插件(buildship)的安裝和使用


前言:博客園上第一篇被人批評的文章,自己又讀了一下,確實有寫的不清楚的地方。

現在想更好的使用gradle,有個更好的辦法。

升級Eclipse至Oxygen版本,已經默認集成這個插件了,強烈推薦。

一、下載gradle

https://gradle.org/gradle-download/

二、手動安裝gradle插件

我選擇的是buildship,經過實際使用,體驗很好。

插件的下載地址是:

http://download.eclipse.org/buildship/updates/e46/milestones/2.x

運行eclipse,點擊Help->Install New Software...

輸入插件的下載地址,選擇安裝,同意license即可。

三、eclipse新建項目

新建選項里多了一個gradle選項。

點擊確定,eclipse會下載gradle-bin-xxx。

等等,我好想已經安裝了gradle啊。

果斷的取消自動下載。

四、使用本地gradle

點擊Window->Preferences->Gradle

啊哈,這里有個Gradle Distribution的配置。

在Local installation directory配置項中選擇本地的bin包解壓路徑即可。

五、重新新建一個gradle項目

這次彈出插件的配置選項。

默認使用步驟四中配置的gradle,直接下一步就好。

六、默認的build.gradle

復制代碼
 1 /*
 2  * This build file was generated by the Gradle 'init' task.
 3  *
 4  * This generated file contains a sample Java project to get you started.
 5  * For more details take a look at the Java Quickstart chapter in the Gradle
 6  * user guide available at https://docs.gradle.org/3.3/userguide/tutorial_java_projects.html
7 */
8 9 // Apply the java plugin to add support for Java 10 apply plugin: 'java'
11
12 // In this section you declare where to find the dependencies of your project
13
repositories { 14
// Use jcenter for resolving your dependencies. 15
// You can declare any Maven/Ivy/file repository here.
16 jcenter() 17
} 18
19 dependencies { 20
// The production code uses Guava
21
compile 'com.google.guava:guava:20.0'
22
23
// Use JUnit test framework
24 testCompile 'junit:junit:4.12'
25 }
復制代碼

啊哈,開始你的gradle之旅吧。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM