gradle (2) gradle notes

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/m0_38060977/article/details/102763845

A gradlew

Easy to build gradle project, if not installed locally gradle. It will automatically download and install, and then build the project
reference: Gradle learning (three) - Gradle Wrapper

Two Gradle daemon

A process running in the background, allowing you to build much faster. We do this through your project information remains in memory as a cache to avoid consuming expensive boot process
Reference: Gradle Learning (Four) - Gradle daemon

Three dependency management

There are two working
1. Looking dependent
2. Upload (output) project

3.1 Statement dependence

apply plugin: 'java'

repositories {//需要手动定义最少一个可以找到你的外部依赖的仓库
    mavenCentral()
}

dependencies {
    compile group: 'org.jsoup', name: 'jsoup', version: '1.11.2'
    testCompile group: 'junit',name:'junit',version: '4.+'
}

Written in a way dependent

dependencies {
    compile group: 'org.jsoup', name: 'jsoup', version: '1.11.2'
}

dependencies {
    compile 'org.jsoup:jsoup:1.11.2'
}

3.2 release output

Dependent configuration can also be used to publish the output of the project, using plug-ins can be completed released, but you still have to tell Gradle posted url and account password.

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url:'http://127.0.0.1:8081/repository/sweetop/') {
                authentication(userName:'admin',password:'admin123')
            }
        }
    }
}

Reference: https://sweetop.blog.csdn.net/article/details/78874802

More than four project build

Reference: https://blog.csdn.net/lastsweetop/article/details/78875987
to split a project into several interdependent small projects contribute to easier understanding, interdependence is very important, by the time the build process multiple project builds up. In Gradle, this is called multi-project build.

The role of the root project build file

  • Construction document root item typically used for configuring the sub in some common configurations , such as so arranged sub common plug-and dependence.
  • root build file can also configure a separate sub-projects, because some configuration all together may be easier to manage.

Guess you like

Origin blog.csdn.net/m0_38060977/article/details/102763845