How to compile PMD with eclipse - eclipse

I have obtained PMD (source code analyzer tool) tool's source code files and I had made some changes. But the problem is when I made these changes on eclipse I couldn't find a way to compile the PMD source code files. Any help would be nice.
Thanks

rulesets/favorites.xml basic

The solution is, if you modified PMD through its source code and you want use it, you must realize that PMD is also a maven project. Therefore maven projects helps you compile and install your modified your program.
In detail, when you compile your PMD, it create test class and a jar file. If you replace those files with the pmd.bin version (not pmd.src version), you will be able to use your modified PMD project.

Related

is there any demo for eclipse cdt api use?

I want to use the eclipse cdt api to resolve c++ code AST tree for code analysis.
base on the blow question answer, I try to create a default Workspace and project by java code. The Workspace init method require many IDE source support, when i fix one resouce issue, another comes. is there any demo for this?
Using CDT without Eclipse
If you want to parser a single source file, it is enough to use cdt.core only. If you want to use the higher level(semantic) you need to replace a lot dependences about those IDE packages. I did a project using Eclipse-JDT and use JavaCore and Workspace to generate IJavaProject. It is similar with CDT. I also do some research about static-code-analysis using JDT/CDT.

How can I use Primefaces in my project as source code not as jar file?

For example I have downloaded Primefaces's source code and imported it in Eclipse as self-project.
Now I want to create a regular JSF project and make it use Primefaces's components by using mentioned earlier Primefaces's project and not importing Primeface's jar, is it possible?
What I want to achieve is to edit the Primefaces's code and see the changes on the fly, after I'll be satisfied with a result I will compile it in a jar.
Thank you.
UPDATE: added picture to display what do I want to achieve
If you use Eclipse with m2e, it will, if you configure m2e to use workspace projects, do this automatically. I use JBossTools as a complete addon to Eclipse. Very satisfied with this. But you DO need the dependency on PrimeFaces in your pom. Just make sure you refer to the custom version (if you rename the artifact or version number)
If you don't use maven, you can try plain eclipse project dependency. See Eclipse - How to give dependency between projects?

Eclipse CheckStyle

Recently I added a new checkstyle (XML) file in Eclipse.
After I ran mvn checkstyle:checkstyle, I saw a bunch of checkstyle errors in A.java.
Then, in Eclipse, I right-clicked A.java, and picked "Apply Checkstyle Fixes." However, no changes were made.
Please advise me on how to apply my checkstyle changes.
Note: I do not have Eclipse configured to build. I only use it for changing code, and then I build using maven on the command-line.
Thanks
I don't know what Eclipse plugin you use, but I use eclipse-cs.
In eclipse-cs, when you write a CheckStyle Checker (a class for detecting CheckStyle-related issues), you can write another class as so-called quickfix. If the writer of a Checker does not provide a quickfix, none will be available to you.
As for the maven issue, where your maven output and Eclipse warnings differ: The configuration of Eclipse may differ from the configuration read by maven. Please make sure both use the same configuration file.
You have to fix your checkstyle warnings manually.

Can I Configure m2eclipse through pom.xml?

With the maven-eclipse-plugin, using mvn eclipse:eclipse, you can specifiy eclipse project natures and builders that will automatically be added to the eclipse project.
Earlier versions of m2eclipse used the configuration block of the maven-eclipse-plugin and also let you activate natures and builders using the same mechanisms. This seems to no longer be the case because a) I can't find any reference to maven-eclipse-plugin in the m2eclipse sources and b) it just doesn't work :-)
So this is my question: is there any way to configure the eclipse project generated by m2eclipse from the pom.xml? Specifically: project builders and natures, but I'd be interested in other options as well.
The following thread summarizes almost everything. First, it explains that m2eclipse doesn't and won't support anything from the Maven Eclipse Plugin anymore because:
Sonatype doesn't maintain it.
It causes them too much troubles.
Second, it states that the m2eclipse way to handle additional project natures and builders is to write project configurators:
(...) we encourage writing configurators to add the natures and builders you want based on what it available in the POM.
See this link for a guide and this project for some existing configurators for checkstyle, findbugs, pmd.
I have now implemented this as a maven plugin I call maven-eclipseconf-plugin.
Unfortunately it's proprietary work for a client, so I can't share it. But let me describe what I do:
Tied to the lifecycle verify, I check for the existence of an eclipse .project file. If it's there, I check it for the presence of the builders and natures I want to automatically add (and you can deactivate this behavior by using a maven property or a stop file with a configurable name). You can also define configuration files that will be written (like .pmd, which is related to this other question of mine). The contents of the Configuration files can be specified inline, it can come from an external file, or from a URL. I also tried to introduce variable substitution in the config files where a special placeholder would be replaced with a multi-moduke-project's root folder, but I had to give up on that approach.
Anyway, the plugin gives me pretty much all the functionality of the maven-eclipse-plugin I ever used (of course there is a lot more though) and I'm happy with that. Perhaps I will build something similar once more in open source when this contract is finished.
Project configurators are the proposed approach. But the latest version of m2e-extensions is from early 2010 and developed against m2eclipse 0.10.x. There is a successor project called m2e-code-quality which is more recent and active and developed against m2eclipse 0.12.x.
But neither m2e-extensions nor m2e-code-quality do support FindBugs at the moment. And there are some other limitations with header files, exclusions and modified JARs.
I have successfully used a universal approach with AntRun, Ant and XMLTask to automatically add project natures, builders and configuration files for Eclipse plugins from pom.xml.

Modifying Existing Eclipse Plugin and Correctly Installing it

I downloaded the source code for the EMF based UML2 Plugin and changed a class in the org.eclipse.uml2.uml.edit project to remove special characters when returning string representations. Now when I export the projects and place the jar files either in the dropins directory or replace my current uml2 plugin jar files in plugins directory, The UML files are no longer recognized, in short my modified plugin does not install correctly (no error is thrown and I can see the files being picked up under Plugins->Target Platform) .
However, When I run the plugin as an eclipse application (from the workspace) I can see the changes I made being reflected in the new instance of eclipse.
What can I do to ensure that the plugin installs correctly?
Is there a documented procedure of how to build the uml2 plugin (or any comparable plugin) after modification?
Select the project and open the context menu. There is an entry PDE near the bottom of the menu. In there, you can find an entry to build the plugin for deployment. This gives you the features and plugins directory with the fixed files. Copy both into your Eclipse install.
Unless the UML2 plugins require some kind of magic build script, exporting the one plugin you changed and overwriting the original in your Eclipse installation should be the easiest solution. One potential problem which comes to mind is conflicting plugin version numbers: make sure you don't have two identical versions of your modified plugin in your Eclipse installation.
When debugging plugins which apparently don't work properly at runtime, I always look at Help > About Eclipse Platform > Configuration Details. This lists all the plugins found by Equinox during startup, along with their status (see the Javadoc of the org.osgi.framework.Bundle interface for explanation).
I faced the exact same problem as you describe here . I dont have any answer to your problem but i am sharing what worked for me .
I created a local update site of the plugin on my system. Create update site for your plug-in article explains very very nicely the steps needed to accomplish this .