Configuring external dependencies.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Mon, 13 Aug 2018 01:33:28 +0300
changeset 2264 abede030dc1d
parent 2263 0243bb26fe02
child 2265 31e11d79a712
Configuring external dependencies.
gradle.rst
--- a/gradle.rst	Wed Aug 08 23:14:45 2018 +0300
+++ b/gradle.rst	Mon Aug 13 01:33:28 2018 +0300
@@ -216,6 +216,54 @@
 
 For each configuration ``build<ConfigurationName>`` and ``upload<ConfigurationName>`` are defined.
 
+Configuring external dependencies
+=================================
+
+Adding large well known artifact repositories::
+
+  repositories {
+    mavenCentral()
+    jcenter()
+  }
+
+``mavelLocal()`` for local ``~/.m2`` or whenever Maven ``settings.xml`` is pointing.
+
+Adding custom repositories::
+
+  repositories {
+    maven { url "http://repo.example.com/maven2" }
+    ivy { url "http://repo.example.com/ivy" }
+    maven {
+      url "http://repo.example.com/maven2"
+      username "ro-user"
+      password "pas$$word"
+    }
+  }
+
+Excluding transitive dependencies::
+
+  compile 'org.springframework:spring-web:4.3.10.RELEASE' {
+      exclude group: 'com.google.code.gson', module: 'gson'
+  }
+
+  configurations.all {
+      exclude group: 'com.google.code.gson', module: 'gson'
+  }
+
+  configurations.runtime {
+      exclude group: 'com.google.code.gson', module: 'gson'
+  }
+
+Forcing a specific version of a transitive dependency::
+
+  configurations.all {
+      resolutionStrategy.force 'com.google.code.gson:gson:2.8.1'
+  }
+
+Declaring dependency on module in multi-module build::
+
+  compile project(':core')
+
 List project properties
 =======================
 ::