計算機領域的技術更新換代是是十分快的,maven的出現解決了很多的問題,以前程序員們在構建程序的時候使用ant自己寫一大推的腳本,maven的出現很好的解決了這個問題,也是maven也成爲了程序員們喜愛的程序構建工具。隨着技術的發展,新技術的出現很好解決了原來技術存在的問題,gradle也是應運而生,隨着hibernate 應用gradle構建代碼,很多大公司也採用這門 技術,尤其在andriod開發中使用更加廣泛。
1、maven是使用xml文件來寫pom,gradle 可以使用groovy,scala,ruby等其他語言來寫pom文件,所以 gradle的寫法更加的靈活。
2、gradle是繼承了maven與ant有點的工具,他解決了maven存在的一些 問題:Build Engineer問題。
3、gralde寫pom文件更加簡潔:
<properties>
<kaptcha.version>2.3</kaptcha.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.code.kaptcha</groupId>
<artifactId>kaptcha</artifactId>
<version>${kaptcha.version}</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
然後我將其轉換成Gradle腳本,結果是驚人的:
dependencies {
compile('org.springframework:spring-core:2.5.6')
compile('org.springframework:spring-beans:2.5.6')
compile('org.springframework:spring-context:2.5.6')
compile('com.google.code.kaptcha:kaptcha:2.3:jdk15')
testCompile('junit:junit:4.7')
}