blob: a16a386c037471501bd74247b7f040397d686519 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<document xmlns="http://maven.apache.org/XDOC/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
<head>
<title>Importing and debugging in Eclipse IDE</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"/>
<script type="text/javascript" src="js/anchors.js"/>
<script type="text/javascript" src="js/google-analytics.js"/>
<link rel="icon" href="images/favicon.png" type="image/x-icon" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/ico" />
</head>
<body>
<section name="Content">
<macro name="toc">
<param name="fromDepth" value="1"/>
<param name="toDepth" value="1"/>
</macro>
</section>
<section name="Download Eclipse">
<p>
Please visit Eclipse IDE <a href="https://eclipse.org"> official web site</a>,
download and install the latest version of Eclipse IDE for Java Developers.
</p>
</section>
<section name="Import Checkstyle Project">
<p>
Select File > Import > Maven > Existing Maven Projects<br/><br/>
<img alt="screenshot" src="images/gui_screenshot_importing_eclipse.png"/>
</p>
</section>
<section name="Setup Maven plugin connectors">
<p>When you import Checkstyle Project, "Setup maven plugin connectors" window will appear.</p>
<p>
Left click on "Finish".<br/><br/>
<img alt="screenshot" src="images/gui_screenshot_setup_maven_plugin_connectors_eclipse.png"/>
<br/><br/>
</p>
<p>
Then plugin "Install" window will appear.
<br/><br/>
Left click on Next > Next.
<br/><br/>
<img alt="screenshot" src="images/gui_screenshot_install_connector_eclipse.png"/>
<br/><br/>
<img alt="screenshot" src="images/gui_screenshot_install_connector_details_eclipse.png"/>
<br/><br/>
Set "I accept the terms of the license agreement" > Finish.
<br/><br/>
<img alt="screenshot" src="images/gui_screenshot_install_connector_license_eclipse.png"/>
</p>
<p>
<br/><br/>
Then "Security Warning" window will appear.
<br/><br/>
Left click on "OK", and then restart Eclipse.<br/><br/>
<img alt="screenshot" src="images/gui_screenshot_install_connector_security_warning_eclipse.png"/>
</p>
<p>
<br/><br/>
Then target/generated-sources/antlr folder will appear in Package Explorer.<br/><br/>
<img alt="screenshot" src="images/gui_screenshot_package_explorer_eclipse.png"/>
</p>
</section>
<section name="Suppress Eclipse warnings on resource files">
<p>
Right click on Checkstyle project > Build Path > Configure Build Path...<br/><br/>
<img alt="screenshot" src="images/gui_screenshot_eclipse_build_path.png"/>
</p>
<p>
Set "Ignore optional compile problems" to "Yes" for following folders:
</p>
<ul>
<li>src/it/resources</li>
<li>src/main/resources</li>
<li>src/test/resources</li>
<li>target/generated-sources/antlr</li>
</ul>
<p>
<img alt="screenshot" src="images/gui_screenshot_eclipse_ignore_warnings.png"/>
</p>
<br/>
<p>
Next, you need to put <i>.ci/org.eclipse.jdt.core.prefs</i> file to the <i>.settings/org.eclipse.jdt.core.prefs</i>
to setup Eclipse compiler.
</p>
</section>
<section name="Organize Imports">
<p>
One of the Checkstyle checks we run on our own code require certain order of import
statements. Few changes in IDE settings are required to help your IDE do it automatically.<br/>
To change settings of "Organize Imports" feature (Kepler, Luna &amp; Mars, other versions
are likely to work the same way), please go to Window -> Preferences in menu.<br/>
In Preferences window select Java->Code Style->Organize Imports (follow numbers on a picture).<br/>
Default configuration should look as following (you can also try Restore Defaults button):<br/><br/>
<img alt="Organize Imports settings in Eclipse" src="images/gui_screenshot_organize_imports_eclipse.png"/>
<br/>
</p>
</section>
<section name="Debug">
<p>
Open the Check's source file by double click on it in a source tree as is shown:<br/><br/>
<img alt="screenshot" src="images/gui_screenshot_select_check_eclipse.png"/>
<br/><br/>
Debug the Check by putting the breakpoint at controversial place (double-click)
on the left part of line number as it is shown:<br/><br/>
<img alt="screenshot" src="images/gui_screenshot_debug_eclipse.png"/>
<br/><br/>
Then right-click the corresponding Unit-test file or class definition > Debug As >
JUnit Test<br/><br/>
<img alt="screenshot" src="images/gui_screenshot_ut_select_eclipse.png"/>
<br/><br/>
Then manage you debug operations by F6 (Step Over), F5 (Step Into), F7 (Step Return)
and F8 (Resume)
</p>
</section>
</body>
</document>