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:
- 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? - same question above,
gradle/wrapper/*
files (gradle-wrapper.jar
,gradle-wrapper.properties
)? - some times see other
*.gradle
files inside project'sgradle
directory. these additional gradle files , represent/do? custom plugins? - what difference in properties go
settings.gradle
vs should defined insidegradle.properties
?
you generate once, , again when you'd change version of gradle use in project. there's no need generate often. here docs. add
wrapper
taskbuild.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
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.give detailed example. such file may have multiple purposes: mutlimodule project, responsibility separation, modified script, etc.
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
Post a Comment