簡體   English   中英

Android lint:如何禁用“NewerVersionAvailable”檢查 testCompile 依賴項?

[英]Android lint: How to disable “NewerVersionAvailable” check for testCompile dependencies?

我正在使用NewerVersionAvailable lint 檢查來確定較新的依賴項版本。 但看起來這個檢查只對implementation依賴有用。 我認為我們不需要很快更新junit 如何禁用對單獨依賴類型的檢查? 為每個testImplementation依賴添加//noinspection很無聊。 給出的例子:

dependencies {

    // should warn
    implementation 'com.android.support:support-annotations:25.0.0'

    // shouldn't warn
    testImplementation 'junit:junit:4.12'
}

最好禁用對單個依賴項的檢查,因為這樣仍然會收到任何進一步過時的庫的通知:

<issue id="NewerVersionAvailable">
    <ignore regexp="junit:junit*"/>
</issue>

使用這樣的模式: junit:junit*可以忽略單個依賴項 - 並且可以使用這樣的模式忽略整個依賴項組: junit:*

這仍然需要結合//noinspection GradleDependency ,因為lint和 IDE 的代碼檢查不是一回事。

您可以在您的項目中為 lint 創建一個配置文件,並將這一行添加到其中,如下所示:

<lint>
   ...
   <issue id="NewerVersionAvailable" severity="ignore" />
   ...
</lint>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM