build.gradle - How/when to generate Gradle wrapper files? -


i trying understand how gradle wrapper works. in many source repos, see following structure:

projectroot/     src/     build.gradle     gradle.properties     settings.gradle     gradlew     gradlew.bat     gradle/         wrapper/             gradle-wrapper.jar             gradle-wrapper.properties 

my questions:

  1. how/when 1 generate gradlew/gradlew.bat? supposed generate them 1 time when project first created, generate them every time commit/push changes? , how generated?
  2. same question above, gradle/wrapper/* files (gradle-wrapper.jar , gradle-wrapper.properties)?
  3. some times see other *.gradle files inside project's gradle directory. these additional gradle files , represent/do? custom plugins?
  4. what difference in properties go settings.gradle vs should defined inside gradle.properties?

  1. you generate once, , again when you'd change version of gradle use in project. there's no need generate often. here docs. add wrapper task build.gradle file , run task wrapper structure.

    mind need have gradle installed generate wrapper. great tool managing g-ecosystem artifacts sdkman!. generate gradle wrapper, add following piece of code build.gradle file:

    task wrapper(type: wrapper) {    gradleversion = '2.0' //version required } 

    and run:

    gradle wrapper 

    task. add resulting files scm (e.g. git) , developers have same version of gradle when using wrapper.

    with gradle 2.4 (or higher) can set wrapper without adding dedicated task:

    gradle wrapper --gradle-version 2.3 

    or

    gradle wrapper --gradle-distribution-url https://myenterpriserepository:7070/gradle/distributions/gradle-2.3-bin.zip 

    all details can found here

  2. these wrapper's files. need generate them once (for particular version) , add version control. if need change version of gradle wrapper, change version in build.gradle see (1.) , regenerate files.

  3. give detailed example. such file may have multiple purposes: mutlimodule project, responsibility separation, modified script, etc.

  4. settings.gradle responsible rather structure of project (modules, names, etc), while, gradle.properties used project's , gradle's external details (version, command line arguments -xx, properties etc.)


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -