Groovy 項目構建工具,Gradle 2.0 發布

jopen 10年前發布 | 28K 次閱讀 Gradle

Gradle就是可以使用Groovy來書寫構建腳本的構建系統,支持依賴管理和多項目,類似Maven,但比之簡單輕便。

usePlugin 'groovy'

repositories {
    flatDir dirs: "lib"
}

dependencies {
    groovy ':groovy-all:1.7.0'
    compile fileTree(dir: 'lib', includes: ['*.jar'])
    runtime fileTree(dir: 'lib', includes: ['*.jar'])
}

// usage: gradle -i run
task run(dependsOn: classes) << {
    captureStandardOutput(LogLevel.INFO)
    ant.java( 
        classname: 'fox.gem.GroovyClass',
        fork: true,
        classpath: "${sourceSets.main.runtimeClasspath.asPath}"
    )
}

以上是Gradle的構建文件build.gradle中的內容,是不是比Ant的build.xml要簡單太多了?這就是“慣例”的力量。由此,我們可 以了解Gradle的第一個特點:“CoC(慣例優于配置)”。只要按照Gradle的慣例,那么可以最大限度的減少build文件的內容。

Gradle 2.0 發布,下載地址:

Version 2.0

Gradle 2.0 is an important milestone in the evolution of Gradle. As explained in the Gradle 2.0 announcement, the change in major version number signals a new backwards compatibility baseline. Many deprecated features and API have been removed in this release, allowing the development team to simplify the codebase and implement new functionality. The “Potential Breaking Changes” section of these release notes list all of the breaking changes that have been made and all Gradle users are strongly encouraged to read the list.

Gradle has matured considerably in the evolution from 1.0 to 2.0. It is more performant and is more memory efficient, particularly for large builds. Performance optimization is a persistent area of investment and work, with further optimizations to come during the 2.x stream. Performance, in all aspects, is critically important to a build system.

In addition to the breaking changes, it's business as usual with the steady evolution of Gradle via new and refined API and features.

The move to Groovy 2.3.2 from Groovy 1.8 brings with it all of the new features added to Groovy in this time. There is now a public API for resolving “source” and “javadoc” JARs for JVM library components. The exposing of Ivy “Extra Info” attributes enables a new class of advanced dependency management use cases. It is now possible to use the SFTP protocol for dependency consumption without using custom Ivy resolvers. Maven POM profile support has also been improved through support for profile activation through absence of a system property. There are also other refinements and improvements detailed below, including improvements to Gradle's support for building native projects.

We hope you enjoy Gradle 2.0 and the coming releases in the 2.x stream.

Table Of Contents

<p>詳細的改進說明請看:<a target="_blank" href="/misc/goto?guid=4958836051804875734">http://www.gradle.org/docs/current/release-notes</a></p>
 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!