2

それは完全なエラーです:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:check (default) on project abc-123-micro-service: Failed during checkstyle configuration: cannot initialize module StrictDuplicateCode - Unable to instantiate 'StrictDuplicateCode' class, it is also not possible to instantiate it as .StrictDuplicateCode, StrictDuplicateCodeCheck, .StrictDuplicateCodeCheck. Please recheck that class name is specified as canonical name or read how to configure short name usage http://checkstyle.sourceforge.net/config.html#Packages. Please also recheck that provided ClassLoader to Checker is configured correctly. -> [Help 1]

checkstyle プラグインの私の Maven 構成:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-checkstyle-plugin</artifactId>
    <version>3.0.0</version>
    <dependencies>
        <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>8.8</version>
        </dependency>
    </dependencies>
    <executions>
        <execution>
            <id>validate</id>
            <phase>validate</phase>
            <configuration>
                <configLocation>checkstyle.xml</configLocation>
                <encoding>UTF-8</encoding>
                <consoleOutput>true</consoleOutput>
                <failsOnError>true</failsOnError>
            </configuration>
            <goals>
                <goal>check</goal>
            </goals>
        </execution>
    </executions>
</plugin>

私の checkstyle.xml 構成ファイルには、エラーに記載されている「重複」ルールが含まれていません。この問題を修正し、すべてのチェックを通過させるにはどうすればよいですか?

編集: checkstyle.xml の内容: https://pastebin.com/kuJAFiiP

4

4 に答える 4

0

まだこの問題に直面している場合は、JAVA_HOME パスを確認してください。私の場合、JDKの代わりにJREが使用されました。私がそれを修正したとき - maven-checkstyle-plugin:3.0.0:check has gone の問題

于 2019-12-03T12:46:06.823 に答える