gpt4 book ai didi

java - 如何将GMetrics工具与Grails 3x应用程序集成

转载 作者:行者123 更新时间:2023-12-02 15:50:07 25 4
gpt4 key购买 nike

实际上,我需要将GMetrics静态代码分析工具与grails 3x应用程序集成在一起,但我无法做到这一点。

如果有人已经做过,请帮助我。

最佳答案

您的build.gradle文件中需要以下代码片段

configurations {
gmetrics
}
dependencies {
...
gmetrics 'org.gmetrics:GMetrics:0.7'
}
task gmetrics {
doLast {
//use GMetrics ant task - http://gmetrics.sourceforge.net/gmetrics-ant-task.html
ant.taskdef(name: 'gmetrics', classname: 'org.gmetrics.ant.GMetricsTask', classpath: configurations.gmetrics.asPath)
//ensure reporting directory created
ant.mkdir(dir: "${project.reporting.baseDir.path}/gmetrics")
ant.gmetrics() {
report(type: 'org.gmetrics.report.BasicHtmlReportWriter') {
option(name: 'outputFile', value: "${project.reporting.baseDir.path}/gmetrics/gmetrics.html")
}
report(type: 'org.gmetrics.report.XmlReportWriter') {
option(name: 'outputFile', value: "${project.reporting.baseDir.path}/gmetrics/gmetrics.xml")
}
fileset(dir: 'src') {
include(name: '**/*.groovy')
//exclusions to filter out any classes with inner classes - sonar doesn't support
exclude(name: '**/*Config*')
}
fileset(dir: 'grails-app') {
include(name: '**/*.groovy')
//exclusions to filter out any classes with inner classes - sonar doesn't support
exclude(name: '**/*Config*')
}
}
}
}

然后,您可以调用gmetrics任务,并在build / reports / gmetrics /中找到报告

关于java - 如何将GMetrics工具与Grails 3x应用程序集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40654857/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com