Jenkins: how to use PMD plugin to analyze a Maven project?

1,982 views
Skip to first unread message

Tan Chen

unread,
Jun 26, 2013, 5:44:02 AM6/26/13
to jenkins...@googlegroups.com
Hello,
I am really new to Jenkins. In fact I have installed the PMD plugin on Jenkins; and then I modified my pom.xml of my Maven Project5I wrote this as followings:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>com.atos.mvnbook.helloworld.HelloWorld</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<reporting>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>

<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>

<properties>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
And then I have configured jenkins about PMD parts and added jxr:jxr pmd:pmd into the building goals.
However, no PMD result and even no PMD logo on the first page of Jenkins. As following is the result of bulding.
Executing Maven: -B -f D:\jenkins\jobs\hello-world\workspace\pom.xml jxr:jxr pmd:pmd
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.atos.mvnbook:hello-world:jar:0.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 20, column 16
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Hello World Project 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-jxr-plugin:2.3:jxr (default-cli) @ hello-world ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO]
[INFO] --- maven-pmd-plugin:3.0.1:pmd (default-cli) @ hello-world ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[PMD] Finding all files that match the pattern pmd.xml
[PMD] Parsing 1 files in D:\jenkins\jobs\hello-world\workspace\target
[PMD] Successfully parsed file D:\jenkins\jobs\hello-world\workspace\target\pmd.xml of module Maven Hello World Project with 0 warnings.
[PMD] File encoding has not been set in pom.xml, using platform encoding windows-1252, i.e. build is platform dependent (see <a href="http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding">Maven FAQ</a>).
And the versions are as followings:
maven version: 3.0.5
java version:1.6.0_45
Please help me check it. Thanks.

Ulli Hafner

unread,
Jun 27, 2013, 10:58:07 AM6/27/13
to jenkins...@googlegroups.com
What exactly is the problem or question? From the log I see that PMD is already running and reporting 0 warnings. 
If there are no warnings then you also can't navigate to the warnings.

Ulli

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Message has been deleted

Tan Chen

unread,
Jun 27, 2013, 5:37:00 PM6/27/13
to jenkins...@googlegroups.com
Thanks for your reply boss!
In fact I am a little foolish about that. As u have said, it workd very well. And at that time, I just didn't know how to see the PMD result. Just a click...
Thank you very much for your help and reply!

Best wishes,

Tan
Reply all
Reply to author
Forward
0 new messages