我有一个大型的JEE Maven Multi模块项目,并通过构建工具模块为Checkstyle共享一组自定义规则和抑制。由于对同一模块的测试,我发现很难发布这个构建工具的稳定版本。
每次运行Maven阶段时,我都会得到不同的执行结果。
这是父pom.xml中的Checkstyle配置:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.plugin.version}</version>
<configuration>
<skip>${skipQATests}</skip>
<configLocation>qa/checkstyle_rules.xml</configLocation>
<propertiesLocation>${checkstyleDir}/checkstyle.properties</propertiesLocation>
<suppressionsLocation>qa/suppressions.xml</suppressionsLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<failOnViolation>true</failOnViolation>
<linkXRef>false</linkXRef>
</configuration>
<executions>
<execution>
<id>checkstyle-compile</id>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
我试图在执行中找到一个模式,项目在一次特定的检查中设置为失败,我找不到“错误”#39;。
我知道如果没有所有项目信息,这种行为很难追踪。但是有没有任何类型的程序,日志,工具可以提供更多有关此问题的信息,以便我可以确定它是一个错误还是一些错误配置?
提前致谢!!
更新
我刚刚在子模块上执行了两次相同的mvn命令我测试了Checkstyle(强制规则违规的测试) - mvn checkstyle:check -X
结果彼此不同,主要区别在于CORRECT EXECUTION(构建失败的那个在第一次尝试时找不到文件)和WRONG EXECUTION(以SUCCESS结尾的那个查找配置文件)在第一次尝试时)
EXEC_1: ...
[DEBUG] The resource 'qa/suppressions.xml' was not found with resourceLoader org.codehaus.plexus.resource.loader.FileResourceLoader.
[DEBUG] The resource 'qa/suppressions.xml' was found as jar:file:/C:/Users/usuario/.m2/repository/com/company/tools/build-tools/0.0.2-SNAPSHOT/build-tools-0.0.2-SNAPSHOT.jar!/qa/suppressions.xml.
[DEBUG] Adding the outputDirectory file:/C:/LAB/PRJ/prj-ejbws/target/classes/ to the Checkstyle class path
[DEBUG] The resource 'qa/checkstyle_N4_JEE.xml' was not found with resourceLoader org.codehaus.plexus.resource.loader.FileResourceLoader.
[DEBUG] The resource 'qa/checkstyle_N4_JEE.xml' was found as jar:file:/C:/Users/usuario/.m2/repository/com/company/tools/build-tools/0.0.2-SNAPSHOT/build-tools-0.0.2-SNAPSHOT.jar!/qa/checkstyle_JEE.xml.
[DEBUG] The resource 'ubic.properties' was found as C:\LAB\PRJ\ubic.properties.
[INFO] Starting audit...
[INFO] --------------------------------------------
[INFO] BUILD FAILURE
[INFO] --------------------------------------------
[INFO] Total time: 1.542s
[INFO] Finished at: Thu Feb 20 16:35:22 CET 2014
[INFO] Final Memory: 8M/20M
[INFO] --------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.11:check (default-cli) on project GestionDelContacto-opsa-ejbws: Failed during checkstyle execution: There are 2 checkstyle errors.
EXEC_2: ...
[DEBUG] The resource 'qa/suppressions.xml' was found as jar:file:/C:/Users/usuario/.m2/repository/com/company/tools/build-tools/0.0.2-SNAPSHOT/build-tools-0.0.2-SNAPSHOT.jar!/qa/suppressions.xml.
[DEBUG] Adding the outputDirectory file:/C:/LAB/PRJ/prj-ejbws/target/classes/ to the Checkstyle class path
[DEBUG] The resource 'qa/checkstyle_N4_JEE.xml' was found as jar:file:/C:/Users/usuario/.m2/repository/com/company/tools/build-tools/0.0.2-SNAPSHOT/build-tools-0.0.2-SNAPSHOT.jar!/qa/checkstyle_JEE.xml.
[DEBUG] The resource 'ubic.properties' was not found with resourceLoader org.codehaus.plexus.resource.loader.ThreadContextClasspathResourceLoader.
[DEBUG] The resource 'ubic.properties' was not found with resourceLoader org.codehaus.plexus.resource.loader.JarResourceLoader.
[DEBUG] The resource 'ubic.properties' was found as C:\LAB\PRJ\ubic.properties.
[INFO] Starting audit...
[INFO] --------------------------------------------
[INFO] BUILD SUCCESS
[INFO] --------------------------------------------
[INFO] Total time: 1.570s
[INFO] Finished at: Thu Feb 20 16:37:05 CET 2014
[INFO] Final Memory: 8M/20M
[INFO] ---------------------------------------------
任何线索?
答案 0 :(得分:0)
停止使用Maven,单独运行CheckStyle。你已经有了足够的“线索”:有时Maven正确地初始化CheckStyle,有时候没有,并且取决于不可靠的基础设施是一个坏主意。