1-How to Install PMD tool in our Eclipse Environment ?
We have to follow
below steps to Install PMD tool
effectively. Of course I have attached screen shot for this process .But please
try to install from the below steps .
v
Eclipse
Help
Install New Software…
v
We will get one form to install new software.
v
We will find ADD button in that form, Click on
that.
v
Again we will find one form(Add Repository) with
two fields (Name and Locations.)
v
In Name field you just give name as PMD .
v
In Location you have to give the address of PMD.
v
We can give this address -- >http://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site/
v
It will show message as pending , wait some second. After that we will get message
Like
PMD for Eclipse 2
PMD for Eclipse 3
PMD for Eclipse 4
Select PMD for
Eclipse 4
Next
Accept
the License
Finish
v
While installing
we will get a security warning, we need to click OK.
v
After Finish Installation it will ask to restart your
Eclipse to do changes. Click OK.
v
Go to perspective check the PMD , if it is
showing in our perspective it means we have successfully installed PMD tool.
Next change the Perspective from Liferay or Java EE
to PMD.
2 - How to use PMD tool ?
v
we can select any project from our Package explorer in Eclipse.
v
Right Click on that project we will get PMD in option, then click on check code.
v
we will get a message like checking with 347 rule
to project…
v
after checking the rule we will get violations outlines console in that we can see
priority, created, rule and error messages.
v
PMD given five priority, based on the error i.e
Blocker, Critical, Urgent, Important, and Warning .
v
Blocker - Red Color
v
Critical – Cyan
v
Urgent – Light Green
v
Important – Violet
v
Warning – Deep blue.
3) We can also restrict PMD do not check the service classes which are created by service build process.
v
Right Click on that package or class we will get
PMD in option, then click on clear violations.
Note:
For Existing Project.
Of course we have to resolve all the errors but we must think
about our logic also because PMD rule is
written by PMD developers if we follow all the rule and start resolving the errors then might be our logic will not
work. So please think before resolving the errors because your logic can effect
some other logic or page. We can also
configure our own rule in PMD tool.
Guys if you are unable to install or use PMD from the above steps ,then you could follow the screen shot to install or use.
v Eclipse
Help
Install New Software…
2. Click on Add button and give the Name as PMD , locations as http://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site/ and click OK.
3) Wait some second and we will get message like PMD for Eclipse 2,3…
4) Select PMD for Eclipse 4 and click next , accept the license and click finish.
Select PMD for Eclipse 4
Next
Accept the License
Finish
5) If our installation goes successfully then we are able to show PMD in our perspective.
Like below image you
can see the PMD. Next change the Perspective from Liferay
or Java EE to PMD.
6 - How to use PMD tool ?
v
we can select any project from our Package explorer in Eclipse.
v
Right Click on that project we will get PMD in option, then click on check code.
v
we will get a message like checking with 347
rule to project…
v
after checking the rule we will get violations outlines console in that we can
see priority, created, rule and error messages.
v
PMD given five priority, based on the error i.e
Blocker, Critical, Urgent, Important, and Warning .
v
Blocker - Red Color
v
Critical – Cyan
v
Urgent – Light Green
v
Important – Violet
v
Warning – Deep blue.
0 comments:
Post a Comment