Esct
Esct

Reputation: 133

PMD-Jenkins: how to use it

I don't know how to use the PMD-jenkins plugin to generate and show my result.

How to generate and show the PMD result in Jenkins?

Upvotes: 3

Views: 15261

Answers (3)

dushyant
dushyant

Reputation: 369

You need to follow below steps: 1. install pmd plugin.

Manage jenkins-> manage plugin -> click on available plugin -> search "pmd plugin" -> install

2. goto job and in build section write

mvn clean install pmd:pmd

3. In post build section choose

"Publish PMD analysis results"

Upvotes: 0

user3571701
user3571701

Reputation: 19

Use this command-

clean install org.apache.maven.plugins:maven-pmd-plugin:3.6:pmd

Upvotes: 1

Peter Kofler
Peter Kofler

Reputation: 9448

PMD jenkins plugin is only displaying the PMD check results. You need to run PMD using Maven as part of your build triggered by Jenkins. For example this could look like that in your pom.xml

<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-pmd-plugin</artifactId>
            <version>2.7.1</version>
            <configuration>
                <linkXRef>false</linkXRef>
                <targetJdk>1.6</targetJdk>
                <rulesets>
                    <ruleset>/rulesets/basic.xml</ruleset>
                </rulesets>
            </configuration>
        </plugin>
    </plugins>
</reporting>

Then PMD-jenkins will know where to pick up the results and publish them for you.

To get the results you will need to add this code to your pom.xml and execute the according target in Jenkins, yes.

Note that this is not related to PMD-plugin in Eclipse. The Eclipse PMD plugin just shows the result of the local analysis, not related to Jenkins.

Upvotes: 6

Related Questions