ComponentModuleMetadataHandler

允許修改相依軟體組件的 metadata。

範例

dependencies {
    modules {
        //Configuring component module metadata for the entire "google-collections" module,
        // declaring that legacy library was replaced with "guava".
        //This way, Gradle's conflict resolution can use this information and use "guava"
        // in case both libraries appear in the same dependency tree.
        module("com.google.collections:google-collections") {
            replacedBy("com.google.guava:guava")
        }
    }
}

屬性

無屬性

方法

方法描述
module(moduleNotation, rule)

允許設定組件模組 metadata。此 metadata 適用於整個組件模組 (例如 "group:name",如 "org.gradle:gradle-core"),無論組件版本為何。

腳本區塊

無腳本區塊

方法詳細資訊

void module(Object moduleNotation, Action<? super ComponentModuleMetadataDetails> rule)

允許設定組件模組 metadata。此 metadata 適用於整個組件模組 (例如 "group:name",如 "org.gradle:gradle-core"),無論組件版本為何。

//declaring that google collections are replaced by guava
//so that conflict resolution can take advantage of this information:
dependencies.modules.module('com.google.collections:google-collections') { replacedBy('com.google.guava:guava') }