Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Gradle BOM importでライブラリバージョン管理 / DroidKaigi...

gyamoto
February 08, 2019

Gradle BOM importでライブラリバージョン管理 / DroidKaigi2019

DroidKaigi2019 Day.2 Room3 11:20-11:50(JA / EN 同時通訳)
https://droidkaigi.jp/2019/timetable/70735
https://www.youtube.com/watch?v=bm_szoMkzMo

gyamoto

February 08, 2019
Tweet

More Decks by gyamoto

Other Decks in Technology

Transcript

  1. ҰॠͰΘ͔Δ Gradle BOM import ͰϥΠϒϥϦόʔδϣϯ؅ཧ dependencies { implementation platform('com.squareup.okhttp3:okhttp-bom:3.12.0') implementation

    'com.squareup.okhttp3:okhttp' implementation 'com.squareup.okhttp3:okhttp-tls' implementation 'com.squareup.okhttp3:okhttp-urlconnection' implementation 'com.squareup.okhttp3:logging-interceptor' testImplementation 'com.squareup.okhttp3:mockwebserver' } dependencies { implementation 'com.squareup.okhttp3:okhttp:3.12.0' implementation 'com.squareup.okhttp3:okhttp-tls:3.12.0' implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.12.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.12.0' testImplementation 'com.squareup.okhttp3:mockwebserver:3.12.0' } ↓
  2. Profile Name : Kohei Yamamoto Job : Android Engineer in

    teamLab GitHub : gyamoto Twitter : farundorl PokemonGo : 3729 7371 0759
  3. Gradle BOM import ͰϥΠϒϥϦόʔδϣϯ؅ཧ 1. Gradle • Gradle & Android

    • Dependency Management 2. BOM • Gradle BOM Import • [Q] Version Conflict? • [nits] For Gradle 4.6 • [nits] Dependency Constraint 3. Future • For Library Creator • For Team Develop ?
  4. Specification • Android Studio : 3.4 Beta3 • Gradle version

    : 5.1.1 (and 4.6) • Gradle script : Groovy
  5. Level1: def xxx_version = '1.2.3' Dependency management dependencies { //

    Example: Retrofit (HTTP Client Library) implementation 'com.squareup.retrofit2:retrofit:2.5.0' implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0' implementation 'com.squareup.retrofit2:converter-moshi:2.5.0' implementation 'com.squareup.retrofit2:retrofit-mock:2.5.0' }
  6. Level1: def xxx_version = '1.2.3' Dependency management dependencies { //

    Example: Retrofit (HTTP Client Library) implementation 'com.squareup.retrofit2:retrofit:2.5.0' implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0' implementation 'com.squareup.retrofit2:converter-moshi:2.5.0' implementation 'com.squareup.retrofit2:retrofit-mock:2.5.0' } ~~~~~ ~~~~~ ~~~~~ ~~~~~ '2.5.0' x 4
  7. Level1: def xxx_version = '1.2.3' Dependency management dependencies { def

    retrofit_version = '2.5.0' implementation "com.squareup.retrofit2:retrofit:$retrofit_version" implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit…" implementation "com.squareup.retrofit2:converter-moshi:$retrofit…" implementation "com.squareup.retrofit2:retrofit-mock:$retrofit…" }
  8. dependencies { implementation 'com.google.firebase:firebase-core:16.0.6' implementation 'com.google.firebase:firebase-auth:16.1.0' implementation 'com.google.firebase:firebase-perf:16.2.3' implementation 'com.google.firebase:firebase-storage:16.0.5'

    implementation 'com.google.firebase:firebase-firestore:18.0.0' implementation 'com.google.firebase:firebase-messaging:17.3.4' } app/build.gradle Level2: def version in ext Dependency management
  9. dependencies { implementation 'com.google.firebase:firebase-core:16.0.6' implementation 'com.google.firebase:firebase-auth:16.1.0' implementation 'com.google.firebase:firebase-perf:16.2.3' implementation 'com.google.firebase:firebase-storage:16.0.5'

    implementation 'com.google.firebase:firebase-firestore:18.0.0' implementation 'com.google.firebase:firebase-messaging:17.3.4' } app/build.gradle, foo/build.gradle, bar/build.gradle, piyo/build.gradle, etc… Level2: def version in ext Dependency management
  10. dependencies { implementation 'com.google.firebase:firebase-core:16.0.6' implementation 'com.google.firebase:firebase-auth:16.1.0' implementation 'com.google.firebase:firebase-perf:16.2.3' implementation 'com.google.firebase:firebase-storage:16.0.5'

    implementation 'com.google.firebase:firebase-firestore:18.0.0' implementation 'com.google.firebase:firebase-messaging:17.3.4' } app/build.gradle, foo/build.gradle, bar/build.gradle, piyo/build.gradle, etc… core: 16.0.6 auth: 16.1.0 pref: 16.2.3 storage: 16.0.5 firestore: 18.0.0 messaging: 17.3.4 16.0.2 15.1.0 16.2.0 16.0.0 17.0.0 17.3.2 16.0.3 16.0.0 16.2.1 16.0.2 17.1.5 17.3.3 15.0.2 15.0.0 16.2.3 15.0.2 16.0.0 17.1.0 Level2: def version in ext Dependency management
  11. dependencies { implementation 'com.google.firebase:firebase-core:16.0.6' implementation 'com.google.firebase:firebase-auth:16.1.0' implementation 'com.google.firebase:firebase-perf:16.2.3' implementation 'com.google.firebase:firebase-storage:16.0.5'

    implementation 'com.google.firebase:firebase-firestore:18.0.0' implementation 'com.google.firebase:firebase-messaging:17.3.4' } app/build.gradle, foo/build.gradle, bar/build.gradle, piyo/build.gradle, etc… core: 16.0.6 auth: 16.1.0 pref: 16.2.3 storage: 16.0.5 firestore: 18.0.0 messaging: 17.3.4 16.0.2 15.1.0 16.2.0 16.0.0 17.0.0 17.3.2 16.0.3 16.0.0 16.2.1 16.0.2 17.1.5 17.3.3 15.0.2 15.0.0 16.2.3 15.0.2 16.0.0 17.1.0 Level2: def version in ext Dependency management
  12. ext { kotlin_version = '1.3.20' ... firebase_core_version = '16.0.6' firebase_auth_version

    = '16.1.0' firebase_pref_version = '16.2.3' firebase_storage_version = '16.0.5' firebase_firestore_version = '18.0.0' firebase_messaging_version = '17.3.4' ... } dependencies.gradle Level2: def version in ext Dependency management
  13. dependencies { implementation "com.google.firebase:firebase-core:$..." implementation "com.google.firebase:firebase-auth:$..." implementation "com.google.firebase:firebase-perf:$..." implementation "com.google.firebase:firebase-storage:$..."

    implementation "com.google.firebase:firebase-firestore:$..." implementation "com.google.firebase:firebase-messaging:$..." } app/build.gradle, foo/build.gradle, bar/build.gradle, piyo/build.gradle, etc… Level2: def version in ext Dependency management
  14. app/build.gradle, foo/build.gradle, bar/build.gradle, piyo/build.gradle, etc… Level3: define dependencies in ext

    Dependency management dependencies { implementation "com.google.firebase:firebase-core:$..."ɹɹɹɹ implementation "com.google.firebase:firebase-auth:$..."ɹɹɹɹ implementation "com.google.firebase:firebase-perf:$..."ɹɹɹɹ implementation "com.google.firebase:firebase-storage:$..." implementation "com.google.firebase:firebase-firestore:$..." implementation "com.google.firebase:firebase-messaging:$..." } Group ID Artifact ID Version
  15. ext { versions = [ kotlin : '1.3.20', okhttp :

    '3.12.1', ] depends = [ kotlin : [ stdlib : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$versions.kotlin", junit : "org.jetbrains.kotlin:kotlin-test-junit:$versions.kotlin", ], firebase : [ core : 'com.google.firebase:firebase-core:16.0.6', ... ], dependencies.gradle Level3: define dependencies in ext Dependency management
  16. Level3: define dependencies in ext Dependency management dependencies { implementation

    depends.kotlin.stdlib implementation depends.kotlin.junit implementation depends.firebase.core implementation depends.firebase.auth implementation depends.firebase.pref ... } app/build.gradle, foo/build.gradle, bar/build.gradle, piyo/build.gradle, etc… Add level4
  17. Level3: define dependencies in ext Dependency management • DroidKaigi/conference-app-2019 •

    buildSrcʹGroupID, ArtifactID, VersionΛఆٛ • */build.gradle ͔Β `Dep.Kotlin.stdlibJvm` ͷΑ͏ʹࢀর ref: https://github.com/DroidKaigi/conference-app-2019/blob/master/buildSrc/src/main/java/dependencies/Dep.kt 
 ref: https://github.com/DroidKaigi/conference-app-2019/blob/master/frontend/android/build.gradle
  18. Dependency management dependencies { def version = '1.2.3' implementation "group:artifact:$version"

    } ext { versions = '1.2.3' } dependencies { implementation "group:artifact:$version" } ext { version = '1.2.3' depends = "group.artifact:$version" } dependencies { implementation depends }
  19. # Dependency management dependencies { def version = '1.2.3' implementation

    "group:artifact:$version" } ext { versions = '1.2.3' } dependencies { implementation "group:artifact:$version" } ext { version = '1.2.3' depends = "group.artifact:$version" } dependencies { implementation depends }
  20. # Dependency management dependencies { def version = '1.2.3' implementation

    "group:artifact:$version" } ext { versions = '1.2.3' } dependencies { implementation "group:artifact:$version" } ext { version = '1.2.3' depends = "group.artifact:$version" } dependencies { implementation depends }
  21. # Dependency management dependencies { def version = '1.2.3' implementation

    "group:artifact:$version" } ext { versions = '1.2.3' } dependencies { implementation "group:artifact:$version" } ext { version = '1.2.3' depends = "group.artifact:$version" } dependencies { implementation depends }
  22. Gradle • ΦʔϓϯιʔεͷϏϧυπʔϧ • Groovy or Kotlin DSL • Highly

    customizable & Fast & Powerful \ Flexible! High Performance! /
  23. Gradle & Android • AndroidͷެࣜϏϧυπʔϧͱͯ͠࠾༻ • Android Plugin for GradleʹΑͬͯΞϓϦͷίϯύΠϧɺ

    ϥΠϒϥϦ/ґଘؔ܎ͷղܾɺςετͷ࣮ߦɺॺ໊ɺ
 ApkͷύοέʔδઃఆͳͲΛఏڙ
  24. Dependency management in Gradle android { ... } dependencies {

    // 1. Local binary dependency implementation fileTree(dir: 'libs', include: ['*.jar']) // 2. Dependency on the "core" module from this project implementation project(':core') // 3. Remote binary dependency implementation 'androidx.appcompat:appcompat:1.0.2' } app/build.gradle
  25. Dependency management in Gradle android { ... } dependencies {

    // 1. Local binary dependency implementation fileTree(dir: 'libs', include: ['*.jar']) // 2. Dependency on the "core" module from this project implementation project(':core') // 3. Remote binary dependency implementation 'androidx.appcompat:appcompat:1.0.2' } app/build.gradle
  26. android { ... } dependencies { // 1. Local binary

    dependency implementation fileTree(dir: 'libs', include: ['*.jar']) // 2. Dependency on the "core" module from this project implementation project(':core') // 3. Remote binary dependency implementation 'androidx.appcompat:appcompat:1.0.2' } app/build.gradle Dependency management in Gradle
  27. android { ... } dependencies { // 1. Local binary

    dependency implementation fileTree(dir: 'libs', include: ['*.jar']) // 2. Dependency on the "core" module from this project implementation project(':core') // 3. Remote binary dependency implementation 'androidx.appcompat:appcompat:1.0.2' } app/build.gradle Dependency management in Gradle
  28. (SBEMF #VJME dependencies { // 1. Local binary dependency implementation

    fileTree(dir: 'libs', include: ['*.jar']) // 2. Dependency on the "core" module from this project implementation project(':core') // 3. Remote binary dependency implementation 'androidx.appcompat:appcompat:1.0.2' } Dependency management in Gradle ref: https://docs.gradle.org/5.1.1/userguide/introduction_dependency_management.html#dependency_management_in_gradle
  29. (SBEMF #VJME dependencies { // 1. Local binary dependency implementation

    fileTree(dir: 'libs', include: ['*.jar']) // 2. Dependency on the "core" module from this project implementation project(':core') // 3. Remote binary dependency implementation 'androidx.appcompat:appcompat:1.0.2' } -PDBM'JMF 3FQPTJUPSZ access artifacts Dependency management in Gradle ref: https://docs.gradle.org/5.1.1/userguide/introduction_dependency_management.html#dependency_management_in_gradle
  30. (SBEMF #VJME /FUXPSL dependencies { ... // 3. Remote binary

    dependency implementation 'androidx.appcompat:appcompat:1.0.2' } download artifacts Dependency management in Gradle ref: https://docs.gradle.org/5.1.1/userguide/introduction_dependency_management.html#dependency_management_in_gradle
  31. (SBEMF #VJME .BWFO 3FQPTJUPSZ *WZ 3FQPTJUPSZ /FUXPSL download artifacts Dependency

    management in Gradle ref: https://docs.gradle.org/5.1.1/userguide/introduction_dependency_management.html#dependency_management_in_gradle dependencies { ... // 3. Remote binary dependency implementation 'androidx.appcompat:appcompat:1.0.2' }
  32. (SBEMF #VJME .BWFO 3FQPTJUPSZ *WZ 3FQPTJUPSZ /FUXPSL download artifacts Dependency

    management in Gradle *.module *.pom ivy.xml module metadata ref: https://docs.gradle.org/5.1.1/userguide/introduction_dependency_management.html#dependency_management_in_gradle dependencies { ... // 3. Remote binary dependency implementation 'androidx.appcompat:appcompat:1.0.2' }
  33. (SBEMF #VJME .BWFO 3FQPTJUPSZ (SBEMF $BDIF *WZ 3FQPTJUPSZ /FUXPSL store/access

    artifacts download artifacts Dependency management in Gradle *.module *.pom ivy.xml module metadata ref: https://docs.gradle.org/5.1.1/userguide/introduction_dependency_management.html#dependency_management_in_gradle
  34. (SBEMF #VJME .BWFO 3FQPTJUPSZ (SBEMF $BDIF -PDBM'JMF 3FQPTJUPSZ *WZ 3FQPTJUPSZ

    /FUXPSL store/access artifacts download artifacts access artifacts Dependency management in Gradle *.module *.pom ivy.xml module metadata ref: https://docs.gradle.org/5.1.1/userguide/introduction_dependency_management.html#dependency_management_in_gradle
  35. BOM • MavenͰ࢖ΘΕ͍ͯΔPOM(Project Object Model) ͷ֦ு • ؔ࿈ϥΠϒϥϦͷόʔδϣϯΛ·ͱΊͯఆٛ͢Δ࢓૊Έ • OkHttp

    : okhttp, okhttp-android-support, okhttp-*** • GCP : google-cloud-core, google-cloud-***, etc... • AWS : aws-java-sdk-core, aws-java-sdk-***, etc... • Gradle͔ΒModule metadataͱͯ͠ࢀরͰ͖Δ
  36. BOM e.g. 'okhttp-bom-3.12.1.pom' <project ... > <modelVersion>4.0.0</modelVersion> <groupId>com.squareup.okhttp3</groupId> <artifactId>okhttp-bom</artifactId> <version>3.12.1</version>

    <packaging>pom</packaging> <name>OkHttp (Bill of Materials)</name> <dependencyManagement> <dependencies> <dependency> <groupId>${project.groupId}</groupId> <artifactId>okhttp</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}.groupId}</groupId> <artifactId>okhttp-tests</artifactId> <version>${project.version}</version> </dependency>
  37. BOM e.g. 'okhttp-bom-3.12.1.pom' <project ... <dependencyManagement> <dependencies> <dependency> <groupId>${project.groupId}</groupId> <artifactId>okhttp</artifactId>

    <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>okhttp-tests</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>okhttp-android-support</artifactId> <version>${project.version}</version> </dependency> <dependency>
  38. BOM e.g. 'com.squareup.okhttp3:okhttp-bom:3.12.1' e.g. okhttp-bom:3.12.1 | (Total: 24 dependencies) ├──

    okhttp:3.12.1 ├── okhttp-tests:3.12.1 ├── okhttp-android-support:3.12.1 ├── okhttp-apache:3.12.1 ├── okhttp-sse:3.12.1 ├── okhttp-testing-support:3.12.1 ├── okhttp-tls:3.12.1 ├── okhttp-urlconnection:3.12.1 ├── okhttp-logging-interceptor:3.12.1 ├── okhttp-dnsoverhttps:3.12.1
  39. BOM e.g. 'com.google.cloud:google-cloud-bom:0.79.0-alpha' e.g. google-cloud-bom | (Total: 154 dependencies) ├──

    google-cloud-core ├── google-cloud-automl ├── google-cloud-datastore ├── google-cloud-dialogflow ├── google-cloud-pubsub ├── google-cloud-storage ├── proto-google-common-protos ├── proto-google-cloud-iot-v1 ├── grpc-google-common-protos ├── grpc-google-cloud-iot-v1
  40. BOM e.g. 'com.amazonaws:aws-java-sdk-pom:1.11.490' e.g. aws-java-sdk-pom | (Total: 167 dependencies) ├──

    aws-java-sdk-core ├── aws-java-sdk-api-gateway ├── aws-java-sdk-s3 ├── aws-java-sdk-iot ├── aws-java-sdk-lambda ├── aws-java-sdk-appsync ├── aws-java-sdk-mobile ├── aws-java-sdk-greengrass ├── aws-java-sdk-dynamodb ├── aws-java-sdk-cognitoidentity
  41. Gradle BOM import • Dependency Version Alignment ͱͯ͠BOM importʹରԠ •

    Gradle5.0͔Βਖ਼ࣜಋೖ • Gradle4.6͔Βࢼݧಋೖ͞Ε͍ͯΔͷͰ࢖༻Մೳ ref: https://docs.gradle.org/5.0/release-notes.html#dependency-version-alignment
 ref: https://docs.gradle.org/4.6/release-notes.html#bom-import
  42. Gradle BOM import dependencies { implementation 'com.squareup.okhttp3:okhttp:3.12.0' implementation 'com.squareup.okhttp3:okhttp-tls:3.12.0' implementation

    'com.squareup.okhttp3:okhttp-urlconnection:3.12.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.12.0' testImplementation 'com.squareup.okhttp3:mockwebserver:3.12.0' } app/build.gradle
  43. Gradle BOM import dependencies {
 // import a BOM implementation

    platform( 'com.squareup.okhttp3:okhttp-bom:3.12.0' )
 implementation 'com.squareup.okhttp3:okhttp:3.12.0' implementation 'com.squareup.okhttp3:okhttp-tls:3.12.0' implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.12.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.12.0' testImplementation 'com.squareup.okhttp3:mockwebserver:3.12.0' } app/build.gradle
  44. Gradle BOM import dependencies { // import a BOM implementation

    platform( 'com.squareup.okhttp3:okhttp-bom:3.12.0' ) // define dependencies without versions implementation 'com.squareup.okhttp3:okhttp' implementation 'com.squareup.okhttp3:okhttp-tls' implementation 'com.squareup.okhttp3:okhttp-urlconnection' implementation 'com.squareup.okhttp3:logging-interceptor' testImplementation 'com.squareup.okhttp3:mockwebserver' } app/build.gradle
  45. Gradle BOM import dependencies { // ... implementation 'com.squareup.okhttp3:okhttp:3.12.0' implementation

    'com.squareup.okhttp3:okhttp-tls:3.12.0' implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.12.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.12.0' testImplementation 'com.squareup.okhttp3:mockwebserver:3.12.0' } app/build.gradle
  46. Gradle BOM import dependencies { // import a BOM implementation

    platform( 'com.squareup.okhttp3:okhttp-bom:3.12.0' ) // define dependencies without versions implementation 'com.squareup.okhttp3:okhttp' implementation 'com.squareup.okhttp3:okhttp-tls' implementation 'com.squareup.okhttp3:okhttp-urlconnection' implementation 'com.squareup.okhttp3:logging-interceptor' testImplementation 'com.squareup.okhttp3:mockwebserver' } app/build.gradle
  47. ext { depends = [ okhttp : [ bom :

    'com.squareup.okhttp3:okhttp-bom:3.12.0', okhttp : 'com.squareup.okhttp3:okhttp', tls : 'com.squareup.okhttp3:okhttp-tls', urlconnection : 'com.squareup.okhttp3:okhttp-urlconnection', logginginterceptor : 'com.squareup.okhttp3:logging-interceptor', mockwebserver : 'com.squareup.okhttp3:mockwebserver', ], ... ] } dependencies.gradle Define dependencies in ext Gradle Bom import
  48. dependencies { // import a BOM implementation platform(depends.okhttp.bom) // define

    dependencies without versions implementation depends.okhttp.okhttp implementation depends.okhttp.okhttp-tls implementation depends.okhttp.okhttp-urlconnection implementation depends.okhttp.logging-interceptor testImplementation depends.okhttp.mockwebserver ... } app/build.gradle Define dependencies in ext Gradle Bom import
  49. [Q] Version conflict?
 Gradle BOM import dependencies { // import

    a BOM implementation platform( 'com.squareup.okhttp3:okhttp-bom:3.12.0' ) implementation('com.squareup.okhttp3:okhttp:3.12.1') { because 'Try new release' } ... }
  50. [Q] Version conflict?
 Gradle BOM import dependencies { // import

    a BOM implementation platform( 'com.squareup.okhttp3:okhttp-bom:3.12.0' ) implementation('com.squareup.okhttp3:okhttp:3.12.1') { because 'Try new release' } ... } okhttp-bom: 3.12.0 okhttp: 3.12.1
  51. [Q] Version conflict?
 Gradle BOM import dependencies { // import

    a BOM implementation platform( 'com.squareup.okhttp3:okhttp-bom:3.12.1' ) implementation 'com.squareup.okhttp3:okhttp:3.11.0' implementation 'com.squareup.okhttp3:okhttp-tls' implementation 'com.squareup.okhttp3:okhttp-urlconnection' implementation 'com.squareup.okhttp3:logging-interceptor' testImplementation 'com.squareup.okhttp3:mockwebserver' } 
 okhttp-bom: 3.12.0 < okhttp: 3.12.1 implementation platform(…) implementation '…'
  52. [Q] Version conflict?
 Gradle BOM import dependencies { // import

    a BOM implementation platform( 'com.squareup.okhttp3:okhttp-bom:3.12.1' ) implementation 'com.squareup.okhttp3:okhttp:3.11.0' implementation 'com.squareup.okhttp3:okhttp-tls' implementation 'com.squareup.okhttp3:okhttp-urlconnection' implementation 'com.squareup.okhttp3:logging-interceptor' testImplementation 'com.squareup.okhttp3:mockwebserver' } 
 okhttp-bom: 3.12.1 ? okhttp: 3.12.0 implementation platform(…) implementation '…'
  53. [Q] Version conflict?
 Gradle BOM import dependencies { // import

    a BOM implementation platform( 'com.squareup.okhttp3:okhttp-bom:3.12.1' ) implementation 'com.squareup.okhttp3:okhttp:3.11.0' implementation 'com.squareup.okhttp3:okhttp-tls' implementation 'com.squareup.okhttp3:okhttp-urlconnection' implementation 'com.squareup.okhttp3:logging-interceptor' testImplementation 'com.squareup.okhttp3:mockwebserver' } 
 okhttp-bom: 3.12.1 > okhttp: 3.12.0 implementation platform(…) implementation '…'
  54. [Q] Version conflict?
 Gradle BOM import dependencies { // import

    a BOM implementation platform( 'com.squareup.okhttp3:okhttp-bom:3.12.1' ) implementation('com.squareup.okhttp3:okhttp:3.12.0') { because 'Try new release' } ... } okhttp-bom: 3.12.1 okhttp: 3.12.0 ~
  55. [Q] Version conflict?
 Gradle BOM import dependencies { // import

    a BOM implementation platform( 'com.squareup.okhttp3:okhttp-bom:3.12.1' ) implementation('com.squareup.okhttp3:okhttp:3.12.0') { force = true } ... } okhttp-bom: 3.12.1 !! okhttp: 3.12.0 !!
  56. [Q] Version conflict?
 Gradle BOM import dependencies { // import

    a BOM implementation platform( 'com.squareup.okhttp3:okhttp-bom:3.12.1' ) implementation('com.squareup.okhttp3:okhttp:3.12.0') { force = true } ... } 
 okhttp-bom: 3.12.1 < okhttp: 3.12.0 implementation platform(…) implementation('…') { force = true }
  57. [Q] Version conflict?
 Gradle BOM import dependencies { // import

    a BOM implementation enforcedPlatform( 'com.squareup.okhttp3:okhttp-bom:3.12.0' ) // this version will be overriden by the one found in the BOM implementation 'com.squareup.okhttp3:okhttp:3.12.1' implementation 'com.squareup.okhttp3:okhttp-tls' implementation 'com.squareup.okhttp3:okhttp-urlconnection' implementation 'com.squareup.okhttp3:logging-interceptor' testImplementation 'com.squareup.okhttp3:mockwebserver' } platform(…) → enforcedPlatform(…)
  58. [Q] Version conflict?
 Gradle BOM import dependencies { // import

    a BOM implementation enforcedPlatform( 'com.squareup.okhttp3:okhttp-bom:3.12.0' ) // this version will be overriden by the one found in the BOM implementation 'com.squareup.okhttp3:okhttp:3.12.1' implementation 'com.squareup.okhttp3:okhttp-tls' implementation 'com.squareup.okhttp3:okhttp-urlconnection' implementation 'com.squareup.okhttp3:logging-interceptor' testImplementation 'com.squareup.okhttp3:mockwebserver' } 
 okhttp-bom: 3.12.0 > okhttp: 3.12.1 implementation enforcedPlatform(…) implementation '…'
  59. [Q] Version conflict?
 Gradle BOM import dependencies { // import

    a BOM implementation enforcedPlatform( 'com.squareup.okhttp3:okhttp-bom:3.12.0' ) // this version will be overriden by the one found in the BOM implementation 'com.squareup.okhttp3:okhttp:3.12.1' implementation 'com.squareup.okhttp3:okhttp-tls' implementation 'com.squareup.okhttp3:okhttp-urlconnection' implementation 'com.squareup.okhttp3:logging-interceptor' testImplementation 'com.squareup.okhttp3:mockwebserver' } 
 okhttp-bom: 3.12.1 > okhttp: 3.12.0 implementation enforcedPlatform(…) implementation '…'
  60. [Q] Version conflict?
 Gradle BOM import dependencies { // import

    a BOM implementation enforcedPlatform( 'com.squareup.okhttp3:okhttp-bom:3.12.0' ) // this version will be overriden by the one found in the BOM implementation 'com.squareup.okhttp3:okhttp:3.12.1' implementation 'com.squareup.okhttp3:okhttp-tls' implementation 'com.squareup.okhttp3:okhttp-urlconnection' implementation 'com.squareup.okhttp3:logging-interceptor' testImplementation 'com.squareup.okhttp3:mockwebserver' } 
 okhttp-bom: 3.12.1 < okhttp: 3.12.0 implementation enforcedPlatform(…) implementation('…') { force = true }
  61. [nits] For Gradle 4.6
 Gradle BOM import dependencies { //

    import a BOM (Gradle 4.6~) // No `enforced` behavior implementation 'com.squareup.okhttp3:okhttp-bom:3.12.0' // define dependencies without versions implementation 'com.squareup.okhttp3:okhttp' implementation 'com.squareup.okhttp3:okhttp-tls' implementation 'com.squareup.okhttp3:okhttp-urlconnection' implementation 'com.squareup.okhttp3:logging-interceptor' testImplementation 'com.squareup.okhttp3:mockwebserver' }
  62. [nits] Dependency constraint (≒ BOM)
 Gradle BOM import dependencies {

    // define the version of dependencies declared in the build script constraints { implementation('org.apache.httpcomponents:httpclient:4.5.3') { because 'previous versions have a bug impact' } implementation('commons-codec:commons-codec:1.11') } 
 // define dependencies without versions implementation 'org.apache.httpcomponents:httpclient' } ref: https://docs.gradle.org/userguide/managing_transitive_dependencies.html#sec:dependency_constraints
  63. For Library Creator Future ର৅ɿOkHttpͷΑ͏ͳϥΠϒϥϦ܈Λఏڙ͍ͯ͠Δଆ 1. ϥΠϒϥϦͷϦϦʔε࣌ʹBOMϑΝΠϧ(pom.xml)Λ༻ҙ 2. ଞϥΠϒϥϦͱಉ͘͡MavenϦϙδτϦʹΞοϓϩʔυ 3.

    [IMO] ϥΠϒϥϦͷಋೖઆ໌Ͱ `implementation platform(...)` ref: "Maven Bill Of Materials (BOM) · Issue #4329 · square/okhttp" https://github.com/square/okhttp/issues/4329