Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/399.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Maven Checkstyle插件没有';即使'failsOnError'设置为'true',也不会在生成过程中失败`_Java_Maven_Maven Checkstyle Plugin - Fatal编程技术网

Java Maven Checkstyle插件没有';即使'failsOnError'设置为'true',也不会在生成过程中失败`

Java Maven Checkstyle插件没有';即使'failsOnError'设置为'true',也不会在生成过程中失败`,java,maven,maven-checkstyle-plugin,Java,Maven,Maven Checkstyle Plugin,我的项目强制执行严格的样式,因此我将maven checkstyle插件作为构建的一部分运行 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>${maven-checkstyle.version}</version> // 3.0

我的项目强制执行严格的样式,因此我将
maven checkstyle插件作为构建的一部分运行

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-checkstyle-plugin</artifactId>
  <version>${maven-checkstyle.version}</version> // 3.0.0
  <executions>
    <execution>
      <id>checkstyle</id>
      <phase>validate</phase>
      <goals>
        <goal>check</goal>
      </goals>
      <configuration>
        <configLocation>google_checks.xml</configLocation>
        <encoding>UTF-8</encoding>
        <consoleOutput>true</consoleOutput>
        <failsOnError>true</failsOnError>
      </configuration>
    </execution>
  </executions>
</plugin>
阅读日志:

[WARN] /Users/jeeves/git/jeeves/demo/src/main/java/com/demo/api/routes/UserRoutes.java:9:57: Parameter name 'BASE_PATH' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'. [ParameterName]
[WARN] /Users/jeeves/git/jeeves/demo/src/main/java/com/demo/api/routes/UserRoutes.java:13: Line is longer than 100 characters (found 102). [LineLength]
Audit done.
这些是警告而不是错误,因此不会触发
true

将以下行添加到
配置中应更改行为:

<violationSeverity>warning</violationSeverity>
<failOnViolation>true</failOnViolation>        <!-- defaults as true, can be omitted -->
警告
真的
见以下文件:

  • 定义违规严重性的级别
  • 发生冲突时触发“失败”事件

顺便说一句,我不确定
故障违规是否必要。将
violationSeverity
设置为
warning
应该足够了。@user2248785默认情况下,
failOnViolation
将设置为
true
,我们不需要显式设置它。
<violationSeverity>warning</violationSeverity>
<failOnViolation>true</failOnViolation>        <!-- defaults as true, can be omitted -->