简体   繁体   中英

multiple executions of PMD maven plugin

I try to execute PMD maven plugin multiple times with different configurations at the same time. 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".

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,只有这个目标有使用的配置值。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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