在Gradle中排除目录的方法是: PMD如何排除目录

huangapple go评论40阅读模式
英文:

PMD in gradle how to exclude directories

问题

我已经在我的Gradle项目中设置了PMD。

我想要从扫描中排除特定目录。

我应该如何做到这一点?这是我的Gradle设置:

pmd {
    toolVersion = "6.48.0"
    sourceSets = listOf(java.sourceSets.findByName("main"))
    ruleSetFiles = files("/ruleset.xml")
}
英文:

So I have set up PMD with in my gradle project.

I want to exclude certain directories from the scan?

How can i do that, this is my gradle setup

pmd {
	toolVersion = "6.48.0"
	sourceSets = listOf(java.sourceSets.findByName("main"))
	ruleSetFiles = files("/ruleset.xml")
}

答案1

得分: 1

以下是翻译好的部分:

"Let's say you want to exclude your java's application file from the task pmdMain, one way you could do that is by writing the following configuration:

pmd {
toolVersion = "6.48.0"
sourceSets = listOf(java.sourceSets.findByName("main"))
ruleSetFiles = files("/ruleset.xml")
pmdMain {
excludes = [
'**/name-of-your-application-file.java'
]
}
}"

英文:

Let's say you want to exclude your java's application file from the task pmdMain, one way you could do that is by writing the following configuration:

pmd {
    toolVersion = "6.48.0"
    sourceSets = listOf(java.sourceSets.findByName("main"))
    ruleSetFiles = files("/ruleset.xml")
    pmdMain {
        excludes = [
                '**/name-of-your-application-file.java'
        ]
    }
}

huangapple
  • 本文由 发表于 2023年5月25日 22:05:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/76333195.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定