@aar with transitive = true 是什么意思
what's the meaning of @aar with transitive = true
我使用 crashlytics 仅作为示例。
和
有什么区别
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { transitive = true; }
和
compile 'com.crashlytics.sdk.android:crashlytics:2.6.8'
如果您在 Gradle 依赖项中使用 ...@artifacttype
表示法,则表示 "only get me this artifact and no transitive dependencies"。通过另外设置 transitive = true
,尽管如此,您还是在获取传递依赖项。
第一个版本获得 aar
和依赖项,据我所知,第二个版本总是获得 jar
(如果存在),除依赖项外什么也没有。添加 configurations.compile.each { println it }
以输出配置中的实际文件,您应该会看到差异。
在crashlytics
的情况下没有区别:
compile 'com.crashlytics.sdk.android:crashlytics:2.6.8'
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/crashlytics/2.6.8/2f667ae0609d82045cbe602d38df3fbf2c9528dd/crashlytics-2.6.8.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/beta/1.2.5/f73d30657bb44ecb79d434a4ae3fb7d887371d84/beta-1.2.5.aar
/home/xan/.gradle/caches/modules-2/files-2.1/io.fabric.sdk.android/fabric/1.3.17/85fc9aae9009f6fb2beaf23fa0ce1ae13f124413/fabric-1.3.17.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/crashlytics-core/2.3.17/f3bed4c297be8d30dc5aa7f18b06dff75435bde4/crashlytics-core-2.3.17.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/answers/1.3.13/83dc1dd439c7da04ce9705f18037fe7551ae06bc/answers-1.3.13.aar
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { transitive = true; }
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/crashlytics/2.6.8/2f667ae0609d82045cbe602d38df3fbf2c9528dd/crashlytics-2.6.8.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/beta/1.2.5/f73d30657bb44ecb79d434a4ae3fb7d887371d84/beta-1.2.5.aar
/home/xan/.gradle/caches/modules-2/files-2.1/io.fabric.sdk.android/fabric/1.3.17/85fc9aae9009f6fb2beaf23fa0ce1ae13f124413/fabric-1.3.17.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/crashlytics-core/2.3.17/f3bed4c297be8d30dc5aa7f18b06dff75435bde4/crashlytics-core-2.3.17.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/answers/1.3.13/83dc1dd439c7da04ce9705f18037fe7551ae06bc/answers-1.3.13.aar
我使用 crashlytics 仅作为示例。
和
有什么区别 compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { transitive = true; }
和
compile 'com.crashlytics.sdk.android:crashlytics:2.6.8'
如果您在 Gradle 依赖项中使用 ...@artifacttype
表示法,则表示 "only get me this artifact and no transitive dependencies"。通过另外设置 transitive = true
,尽管如此,您还是在获取传递依赖项。
第一个版本获得 aar
和依赖项,据我所知,第二个版本总是获得 jar
(如果存在),除依赖项外什么也没有。添加 configurations.compile.each { println it }
以输出配置中的实际文件,您应该会看到差异。
在crashlytics
的情况下没有区别:
compile 'com.crashlytics.sdk.android:crashlytics:2.6.8'
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/crashlytics/2.6.8/2f667ae0609d82045cbe602d38df3fbf2c9528dd/crashlytics-2.6.8.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/beta/1.2.5/f73d30657bb44ecb79d434a4ae3fb7d887371d84/beta-1.2.5.aar
/home/xan/.gradle/caches/modules-2/files-2.1/io.fabric.sdk.android/fabric/1.3.17/85fc9aae9009f6fb2beaf23fa0ce1ae13f124413/fabric-1.3.17.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/crashlytics-core/2.3.17/f3bed4c297be8d30dc5aa7f18b06dff75435bde4/crashlytics-core-2.3.17.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/answers/1.3.13/83dc1dd439c7da04ce9705f18037fe7551ae06bc/answers-1.3.13.aar
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { transitive = true; }
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/crashlytics/2.6.8/2f667ae0609d82045cbe602d38df3fbf2c9528dd/crashlytics-2.6.8.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/beta/1.2.5/f73d30657bb44ecb79d434a4ae3fb7d887371d84/beta-1.2.5.aar
/home/xan/.gradle/caches/modules-2/files-2.1/io.fabric.sdk.android/fabric/1.3.17/85fc9aae9009f6fb2beaf23fa0ce1ae13f124413/fabric-1.3.17.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/crashlytics-core/2.3.17/f3bed4c297be8d30dc5aa7f18b06dff75435bde4/crashlytics-core-2.3.17.aar
/home/xan/.gradle/caches/modules-2/files-2.1/com.crashlytics.sdk.android/answers/1.3.13/83dc1dd439c7da04ce9705f18037fe7551ae06bc/answers-1.3.13.aar