gradle介紹

Gradle是什麼?html

https://gradle.org/whygradle-build-automation/編程

自動化編譯的工具,可編程,適合各類語言,管理各類依賴,高效,提供分析報告。maven

我我的以爲跟Maven很接近。工具

其實,我比較關係的是如何從Maven切換到Gradle去,因此,問題:學習

1. Gradle如何去獲取私有庫的庫文件?gradle

http://www.open-open.com/lib/view/open1434522817864.htmlui

統一設置一個init.gradle 在User_HOME\.gradle 目錄下面this

這裏給一個例子:url

 

/*
* https://yrom.net/blog/2015/02/07/change-gradle-maven-repo-url/
* Gradle 修改 Maven 倉庫地址
* this file will be put in USER_HOME/.gradle directory
* */

allprojects{
repositories {
def REPOSITORY_URL = 'http://nexus.inner.umu360.com:8081/nexus/content/groups/public/'
all { ArtifactRepository repo ->
if(repo instanceof MavenArtifactRepository){
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL."
remove repo
}
}
}
maven {
url REPOSITORY_URL
}
}
}

2. Gradle的語法spa

是groovy語法結構,很簡單。就是你看得懂,若是想深刻學習,看看groovy的語法文章

3.Gradle 打包完畢後war的位置

運營Build任務後,會直接在.Build目錄中找到,這裏我認爲是能夠指定編譯出來的位置。

相關文章
相關標籤/搜索