Pau*_*nis 22 java checkstyle maven
如果有checkstyle
错误,是否有可能以某种方式迫使maven失败?现在我必须运行site
目标来生成javadocs
和checkstyle
报告.我想在install
目标上实现它,如果checkstyle有一些错误,我需要构建失败.这有可能实现吗?
现在我有我checkstyle
的maven报告块:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<configLocation>src/test/resources/checkstyle.xml</configLocation>
</configuration>
</plugin>
</plugins>
</reporting>
Run Code Online (Sandbox Code Playgroud)
hgr*_*rey 29
您需要绑定checkstyle:check
到Maven生命周期阶段(例如,验证)并设置failOnViolation
为true.
就像是:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>checkstyle</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<failOnViolation>true</failOnViolation>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
小智 5
问题问题可能已经有一段时间了,但这对我不起作用.
对于可能与我有相同问题的任何其他人,尽管存在大量问题,但构建成功,我通过将violationSeverity
属性从默认值降低error
到warning
插件的configuration
块来修复它.
归档时间: |
|
查看次数: |
18381 次 |
最近记录: |