我们有一个Maven项目,其中包括CheckStyle和PMD作为分析仪。
问题是CheckStyle有时会采用我的配置和修改的Google_checks.s.xml文件,有时它使用vanilla goole_checks.xml文件并抛出checkStyle错误,这对于它使用的文件是有效的,但我不知道它在哪里得到该文件。从。我的pom看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
<pluginManagement>
<plugins>
<!-- checkstyle -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- google checks -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<configLocation>google_checks.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failOnViolation>true</failOnViolation>
<violationSeverity>warning</violationSeverity>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.20</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.12.0</version>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<failOnViolation>true</failOnViolation>
<printFailingErrors>true</printFailingErrors>
</configuration>
<goals>
<goal>check</goal>
<goal>cpd-check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<!-- PMD -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.12.0</version>
<configuration>
<failOnViolation>true</failOnViolation>
</configuration>
</plugin>
<!-- JXR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</reporting>
</project>
我认为我认为不确定的pom中删除了一些部分。完整的项目位于这里:https://code.toold.xyz/hochschule/webanserver/src/branch/mavensetup/cuebox_source
首先执行MVN清洁时,它可以可靠地工作,但是当我进行MVN编译,然后不更改任何内容时,MVN会再次编译。有时,它会引发很多错误,关于凹痕……我从Google_checks.xml中删除了这些错误。它在目标文件夹中创建CheckStyle-checker.xml,有时包含我的Google_checks.s.xml文件中不包含的内容,它看起来更像是原始的Google_checks.xml文件。
。您知道是什么原因导致了这个问题?
看来,这个问题是用google_checks.s.xml名称重命名并对其进行了测试,现在它始终运行无瑕。似乎Maven解释了Google_checks.xml不是文件名,而是作为引用并下载或从某处提取
如果有人在这里确切知道是否发生了...请解释一下,我会接受您的答案:(