Gradle Checkstyle插件控制台输出 [英] Gradle Checkstyle Plugin Console Output

查看:178
本文介绍了Gradle Checkstyle插件控制台输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Gradle Checkstyle插件在使用 -info 选项运行Gradle时会产生很多控制台输出。这个输出往往会从其他任务中汲取更多有用的输出。



插件配置如下:

<$ p $

$ b $ configFile = file($ rootProject.projectDir / config / checkstyle / checkstyle.xml)
} $ b $ checkstyle {
toolVersion ='6.15' b

要查看问题,可以像这样启动构建:

  ./ gradlew clean checkStyleMain -info 

输出然后显示在控制台如下(编辑为简洁!):

 :core:checkstyleMain 
执行任务' :core:checkstyleMain'(最新检查花费0.007秒),原因是:
....
[ant:xslt]加载样式表< xsl:stylesheet xmlns:xsl =http: //www.w3.org/1999/XSL/Transformversion =1.0>
...
< xsl:template match =checkstyle>
< html>
< head>
< style type =text / css>
...
< / xsl:template>
...
< / xsl:stylesheet>
:core:checkstyleMain(线程[Daemon worker Thread 2,5,main])完成。花了0.878秒。

Gradle版本是2.10,Checkstyle插件版本是6.15。



有人知道如何减少或抑制Checkstyle任务的控制台输出吗?

解决方案

如果你想暂时改变一个任务的日志级别,你可以这样做:

  checkstyleMain {
logging.setLevel( LogLevel.LIFECYCLE)
}

记录将恢复为默认值, code> -info 完成此任务。


The Gradle Checkstyle plugin produces a lot of console output when Gradle is run with the -info option. This output tends to swamp more useful output from other tasks.

The plugin is configured as follows:

checkstyle {
    toolVersion = '6.15'
    configFile = file("$rootProject.projectDir/config/checkstyle/checkstyle.xml")
}

To see the problem, the build can be launched like this:

./gradlew clean checkStyleMain -info

The output then shows in the console as follows (edited for brevity!):

:core:checkstyleMain
Executing task ':core:checkstyleMain' (up-to-date check took 0.007 secs) due to:
....
[ant:xslt] Loading stylesheet <xsl:stylesheet    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
...
<xsl:template match="checkstyle">
    <html>
        <head>
        <style type="text/css">
...
</xsl:template>
...
</xsl:stylesheet>
:core:checkstyleMain (Thread[Daemon worker Thread 2,5,main]) completed. Took 0.878 secs.

The Gradle version is 2.10 and the Checkstyle plugin version is 6.15.

Does anyone know how to reduce or suppress the console output from the Checkstyle tasks?

解决方案

If you want to temporarily change the log level for just one task, you can do:

checkstyleMain{
    logging.setLevel(LogLevel.LIFECYCLE)
}

Logging will revert back to default, in your case, -info once this task is completed.

这篇关于Gradle Checkstyle插件控制台输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆