gradle.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 10 Feb 2018 01:28:53 +0200
changeset 2227 1e9323e7ec88
parent 2158 4273aeaa0c1a
child 2248 0498f4c91fda
permissions -rw-r--r--
Removed files: I don't longer have interest on topic.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2078
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
========
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
 Gradle
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
========
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
.. contents::
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
   :local:
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
Getting help
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
============
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
::
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
  $ gradle --help
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
2094
33c10259cb4d Running build on specific subproject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2086
diff changeset
    14
Working with subprojects
33c10259cb4d Running build on specific subproject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2086
diff changeset
    15
========================
33c10259cb4d Running build on specific subproject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2086
diff changeset
    16
33c10259cb4d Running build on specific subproject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2086
diff changeset
    17
Getting list of subprojects::
2083
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
    18
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
    19
  $ gradle projects
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
    20
2094
33c10259cb4d Running build on specific subproject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2086
diff changeset
    21
Running build on specific subproject::
33c10259cb4d Running build on specific subproject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2086
diff changeset
    22
33c10259cb4d Running build on specific subproject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2086
diff changeset
    23
  $ gradle :$SUB:clean
33c10259cb4d Running build on specific subproject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2086
diff changeset
    24
  $ gradle -p $SUB clean
2095
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    25
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    26
If subproject lies in hierarchy::
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    27
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    28
  $ gradle :$SUB/$SUBSUB:clean
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    29
  $ gradle -p $SUB/$SUBSUB clean
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    30
2104
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
    31
Skip building dependent modules, build just current module::
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
    32
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
    33
  $ gradle -a build
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
    34
  $ gradle --no-rebuild build
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
    35
  $ gradle -a :client:build
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
    36
2095
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    37
Creating multilevel project::
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    38
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    39
  $ mkdir $PRJROOT
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    40
  $ cd $PRJROOT
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    41
  $ mkdir lvl1 lvl1/lvl2
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    42
  $ touch build.gradle lvl1/build.gradle lvl1/lvl2/build.gradle
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    43
  $ { echo include "'lvl1'"; echo include "'lvl1/lvl2'"; } >settings.gradle
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    44
  $ gradle projects
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    45
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    46
``settings.gradle`` can include per line or a list of subprojects::
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    47
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    48
  include 'sub1', 'sub2', 'sub2'
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    49
  include 'lvl1'
b9bf144836b8 Creating multilevel project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2094
diff changeset
    50
  include 'lvl1/lvl2'
2094
33c10259cb4d Running build on specific subproject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2086
diff changeset
    51
33c10259cb4d Running build on specific subproject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2086
diff changeset
    52
https://docs.gradle.org/current/userguide/intro_multi_project_builds.html
33c10259cb4d Running build on specific subproject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2086
diff changeset
    53
http://stackoverflow.com/questions/16976214/gradle-build-only-one-module
33c10259cb4d Running build on specific subproject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2086
diff changeset
    54
2130
511c1dd5b010 Running completely isolated build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2120
diff changeset
    55
Running completely isolated build
511c1dd5b010 Running completely isolated build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2120
diff changeset
    56
=================================
511c1dd5b010 Running completely isolated build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2120
diff changeset
    57
511c1dd5b010 Running completely isolated build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2120
diff changeset
    58
To avoid using global cache and for really clean build use::
511c1dd5b010 Running completely isolated build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2120
diff changeset
    59
511c1dd5b010 Running completely isolated build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2120
diff changeset
    60
  $ gradle --no-daemon --gradle-user-home ./.gradle.local
511c1dd5b010 Running completely isolated build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2120
diff changeset
    61
2104
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
    62
Managing tasks
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
    63
==============
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
    64
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
    65
List tasks::
2078
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
  $ gradle tasks
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
2083
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
    69
Getting list of supported tasks in each subproject::
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
    70
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
    71
  $ gradle tasks --all
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
    72
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
    73
Getting help on task::
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
    74
2156
de9f7c02b6e9 Example without suppressing additional output.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2130
diff changeset
    75
  $ gradle help --task build
2083
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
    76
  $ gradle -q help --task build
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
    77
2086
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
    78
Similar but to each task::
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
    79
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
    80
  $ gradle model
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
    81
2104
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
    82
Skip task during build with ``-x`` option::
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
    83
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
    84
  $ gradle -x test build
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
    85
  $ gradle -x :core:build :client:build
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
    86
2078
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
Build sources
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    88
=============
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    89
::
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    90
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    91
  $ gradle compileJava
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    92
  $ gradle compileTestJava
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    93
2118
df69c36275d6 Build with additional options and checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2117
diff changeset
    94
Build with additional options and checks::
df69c36275d6 Build with additional options and checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2117
diff changeset
    95
df69c36275d6 Build with additional options and checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2117
diff changeset
    96
  compileJava {
df69c36275d6 Build with additional options and checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2117
diff changeset
    97
    options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
df69c36275d6 Build with additional options and checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2117
diff changeset
    98
  }
df69c36275d6 Build with additional options and checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2117
diff changeset
    99
  compileTestJava {
df69c36275d6 Build with additional options and checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2117
diff changeset
   100
    options.encoding = 'UTF-8'
df69c36275d6 Build with additional options and checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2117
diff changeset
   101
    options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
df69c36275d6 Build with additional options and checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2117
diff changeset
   102
  }
df69c36275d6 Build with additional options and checks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2117
diff changeset
   103
2119
3fd683bb6af2 Apply change recursively to subprojects.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2118
diff changeset
   104
To apply change recursively to subprojects::
3fd683bb6af2 Apply change recursively to subprojects.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2118
diff changeset
   105
3fd683bb6af2 Apply change recursively to subprojects.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2118
diff changeset
   106
  subprojects {
3fd683bb6af2 Apply change recursively to subprojects.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2118
diff changeset
   107
      tasks.withType(JavaCompile) {
3fd683bb6af2 Apply change recursively to subprojects.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2118
diff changeset
   108
          options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
3fd683bb6af2 Apply change recursively to subprojects.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2118
diff changeset
   109
      }
3fd683bb6af2 Apply change recursively to subprojects.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2118
diff changeset
   110
  }
3fd683bb6af2 Apply change recursively to subprojects.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2118
diff changeset
   111
2078
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   112
Run main class
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   113
==============
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   114
::
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   115
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   116
  $ gradle run
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   117
2086
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   118
Run tests
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   119
=========
2104
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
   120
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
   121
To run test::
2086
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   122
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   123
  $ gradle test
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   124
2104
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
   125
To skip tests in build::
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
   126
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
   127
  $ gradle -x test build
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
   128
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
   129
Better solution involves passing system property with ``build.gradle``::
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
   130
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
   131
  test.onlyIf { ! Boolean.getBoolean('skip.tests') }
6931c02bbc0e Skipping tasks and dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2095
diff changeset
   132
2086
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   133
To run tests with additional registered checks::
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   134
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   135
  $ gradle check
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   136
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   137
.. note::
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   138
   ``--rerun-tasks`` option *specifies that any task optimization is ignored*.
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   139
   In that way you may rerun tests even if there are no changed files::
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   140
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   141
     $ gradle test --rerun-tasks
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   142
2120
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   143
By default ``System.out`` and ``Sysyem.err`` redirected so you wouldn't see
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   144
anything about test on console.
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   145
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   146
Quick way to see test output is::
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   147
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   148
  $ gradle test -i
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   149
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   150
Alternatively configure ``test`` task::
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   151
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   152
  test {
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   153
    testLogging {
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   154
      events "passed", "skipped", "failed" //, "standardOut", "standardError"
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   155
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   156
      showExceptions true
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   157
      exceptionFormat "full"
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   158
      showCauses true
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   159
      showStackTraces true
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   160
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   161
      showStandardStreams = false
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   162
    }
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   163
  }
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   164
2078
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   165
Stopping server
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   166
===============
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   167
::
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   168
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   169
  $ gradle --stop
e7fe6c24cf5f About Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   170
2083
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   171
List project dependencies
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   172
=========================
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   173
2086
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   174
List of project execution dependencies (it also download dependencies)::
2083
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   175
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   176
  $ gradle dependencies
2086
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   177
  $ gradle dependencies --configuration compile
2083
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   178
  $ gradle dependencies -p $SUBPROJ
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   179
  $ gradle :$SUBPROJ:dependencies
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   180
  $ gradle :$SUBPROJ:dependencies --configuration testCompile
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   181
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   182
List of project plugin dependencies::
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   183
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   184
  $ gradle buildEnvironment
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   185
  $ gradle buildEnvironment -p $SUBPROJ
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   186
  $ gradle :$SUBPROJ:buildEnvironment
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   187
2086
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   188
Paths to dependencies can be printed via task::
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   189
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   190
  task printDepPaths {
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   191
    doLast { configurations.runtime.each { println it } }
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   192
  }
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   193
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   194
All dependencies can be copied to single directory via task::
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   195
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   196
  task copyRuntimeLibs(type: Copy) {
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   197
    into "lib"
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   198
    from configurations.runtime
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   199
    // from configurations.testRuntime - configurations.runtime
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   200
  }
c07317dca036 Run tests.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2083
diff changeset
   201
2083
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   202
List project properties
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   203
=======================
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   204
::
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   205
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   206
  $ gradle properties
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   207
  $ gradle :$SUBPROJ:properties
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   208
  $ gradle properties -p $SUBPROJ
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   209
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   210
Dry tun
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   211
=======
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   212
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   213
``-m`` option allow parsing build scripts without actually executing them::
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   214
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   215
  $ gradle -m clean compile
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   216
2158
4273aeaa0c1a Bootstrap project structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2157
diff changeset
   217
Bootstrap project structure
4273aeaa0c1a Bootstrap project structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2157
diff changeset
   218
===========================
4273aeaa0c1a Bootstrap project structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2157
diff changeset
   219
4273aeaa0c1a Bootstrap project structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2157
diff changeset
   220
This creates simple project with Gradle boilerplate files::
4273aeaa0c1a Bootstrap project structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2157
diff changeset
   221
4273aeaa0c1a Bootstrap project structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2157
diff changeset
   222
  $ gradle init --type java-library
4273aeaa0c1a Bootstrap project structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2157
diff changeset
   223
4273aeaa0c1a Bootstrap project structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2157
diff changeset
   224
To convert Maven project (with ``pom.xml`` file) to Gradle project use::
4273aeaa0c1a Bootstrap project structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2157
diff changeset
   225
4273aeaa0c1a Bootstrap project structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2157
diff changeset
   226
  $ gradle init --type pom
4273aeaa0c1a Bootstrap project structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2157
diff changeset
   227
4273aeaa0c1a Bootstrap project structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2157
diff changeset
   228
https://docs.gradle.org/current/userguide/build_init_plugin.html
4273aeaa0c1a Bootstrap project structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2157
diff changeset
   229
  Official docs on ``init`` plugin.
4273aeaa0c1a Bootstrap project structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2157
diff changeset
   230
2157
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   231
Gradle wrapper
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   232
==============
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   233
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   234
With Gradle v2.4 and above::
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   235
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   236
  $ cd $PROJ
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   237
  $ gradle wrapper --gradle-version 3.5
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   238
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   239
It will add ``gradle/wrapper/gradle-wrapper.jar`` to project root and next call
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   240
to ``./gradlew`` download Gradle distribution from ``distributionUrl`` parameter
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   241
from ``gradle/wrapper/gradle-wrapper.properties`` file. Dictribution will be
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   242
cached in ``~/.gradle/wrapper/dists.gradle/wrapper/dists`` directory so next
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   243
calls won't require download.
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   244
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   245
Alternatively define task::
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   246
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   247
  task wrapper(type: Wrapper) {
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   248
      gradleVersion = '2.0'
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   249
  }
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   250
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   251
For increase security add ``distributionSha256Sum`` parameter to
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   252
``gradle-wrapper.properties`` file. Distribution SHA-256 sum can be obtained via
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   253
``shasum`` utility.
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   254
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   255
https://docs.gradle.org/current/userguide/gradle_wrapper.html
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   256
  Official docs.
e5b91cfd93ce Gradle wrapper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2156
diff changeset
   257
2108
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   258
Managing Gradle cache
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   259
=====================
2083
75ae6a4ad500 Getting list of supported tasks. List project dependencies. List project properties.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2078
diff changeset
   260
2108
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   261
Work in offline mode with ``--offline`` option.
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   262
2120
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   263
Invalidate cache (force re-downloading dependencies) with
5f5defb2793f testLogging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2119
diff changeset
   264
``--refresh-dependencies`` option.
2108
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   265
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   266
Alternatively remove ``~/.m2/repository/`` and ``~/.gradle/caches`` directories.
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   267
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   268
Gradle cached modules declared as *changing*::
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   269
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   270
  dependencies {
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   271
    compile("com.evil:evil-api:1.0.1-SNAPSHOT") { changing=true }
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   272
  }
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   273
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   274
Default timeout is 24 hours and can be reset/changed via::
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   275
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   276
  configurations.all {
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   277
      resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   278
  }
651a45561a46 Managing Gradle cache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2104
diff changeset
   279
2117
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   280
Download sources and javadoc of dependencies
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   281
============================================
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   282
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   283
To download sources and javadoc of dependencies to local ``~/.gradle`` cache add
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   284
``idea`` plugin to your ``build.gradle``::
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   285
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   286
  apply plugin: 'idea'
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   287
  idea.module.downloadJavadoc = true
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   288
  idea.module.downloadSources = true
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   289
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   290
and invoke plugin::
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   291
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   292
  $ gradle idea
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   293
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   294
To wipe out Idea projects file after plug-in run::
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   295
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   296
  $ gradle cleanIdea
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   297
22f21cc41569 Download sources and javadoc of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2108
diff changeset
   298