简体   繁体   English

多次执行 PMD maven 插件

[英]multiple executions of PMD maven plugin

I try to execute PMD maven plugin multiple times with different configurations at the same time.我尝试同时使用不同的配置多次执行 PMD maven 插件。 The executions do work but they always uses the first configuration.执行确实有效,但它们始终使用第一个配置。 My idea was to check java, jsp and javascript alltogether with just "mvn verify".我的想法是只用“mvn verify”来检查 java、jsp 和 javascript。

Can't find any similar documentation or problem out there.找不到任何类似的文档或问题。

My configuration is as follows:我的配置如下:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>3.9.0</version>
        <configuration>
            <failOnViolation>false</failOnViolation>
            <printFailingErrors>true</printFailingErrors>
        </configuration>
        <executions>
            <!-- test java -->
            <execution>
                <id>check-java</id>
                <phase>test</phase>
                <goals>
                    <goal>check</goal>
                </goals>
                <configuration>
                    <language>java</language>
                    <sourceEncoding>cp1252</sourceEncoding>
                    <rulesets>
                        <ruleset>/category/java/bestpractices.xml</ruleset>
                        <ruleset>/category/java/codestyle.xml</ruleset>
                        <ruleset>/category/java/design.xml</ruleset>
                        <ruleset>/category/java/errorprone.xml</ruleset>
                        <ruleset>/category/java/multithreading.xml</ruleset>
                        <ruleset>/category/java/performance.xml</ruleset>
                    </rulesets>
                    <includes>
                        <include>**/*.java</include>
                    </includes>
                </configuration>
            </execution>
            <!-- test jsp -->
            <!-- currently only the first configuration is working -->
            <execution>
                <id>check-jsp</id>
                <phase>test</phase>
                <goals>
                    <goal>check</goal>
                </goals>
                <configuration>
                    <language>jsp</language>
                    <rulesets>
                        <ruleset>/category/jsp/bestpractices.xml</ruleset>
                        <ruleset>/category/jsp/codestyle.xml</ruleset>
                        <ruleset>/category/jsp/design.xml</ruleset>
                        <ruleset>/category/jsp/errorprone.xml</ruleset>
                        <ruleset>/category/jsp/security.xml</ruleset>
                    </rulesets>
                    <includes>
                        <include>**/*.jsp</include>
                    </includes>
                    <compileSourceRoots>
                        <compileSourceRoot>${basedir}/WebContent</compileSourceRoot>
                    </compileSourceRoots>
                </configuration>
            </execution>
            <!-- test javascript -->
            <!-- currently only the first configuration is working -->
            <execution>
                <id>check-javascript</id>
                <phase>test</phase>
                <goals>
                    <goal>check</goal>
                </goals>
                <configuration>
                    <language>javascript</language>
                    <rulesets>
                        <ruleset>/category/ecmascript/bestpractices.xml</ruleset>
                        <ruleset>/category/ecmascript/codestyle.xml</ruleset>
                        <ruleset>/category/ecmascript/errorprone.xml</ruleset>
                    </rulesets>
                    <includes>
                        <include>**/*.js</include>
                    </includes>
                    <compileSourceRoots>
                        <compileSourceRoot>${basedir}/WebContent/javascript</compileSourceRoot>
                    </compileSourceRoots>
                </configuration>
            </execution>
        </executions>
    </plugin>

简单的解决方案:目标需要是pmd,只有这个目标有使用的配置值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM