cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF > Connecting Maven, Eclipse, Checkstyle, and PMD
Date Tue, 14 Jul 2009 13:02:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CXF&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/CXF/Connecting+Maven%2C+Eclipse%2C+Checkstyle%2C+and+PMD">Connecting
Maven, Eclipse, Checkstyle, and PMD</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~bimargulies@gmail.com">Benson
Margulies</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <p>You want to check your Java code with PMD and Checkstyle.</p>

<p>You know what to do, you set up some rules files.</p>

<p>You build with maven 2.</p>

<p>You know what to do, you set up the plugins.</p>

<p>You type at Eclipse.</p>

<p>Now you have trouble. You need:</p>

<p>a) Your Eclipse code formatting style, warning, and cleanup to be consistent with
your rules.<br/>
b) Eclipse configuration for the Eclipse plugins for PMD and Checkstyle that are consistent
with<br/>
your rules.</p>

<p>If you start looking at this, you will get a headache.</p>

<p>Luckily for you, Dan Kulp did a ton of work to make this work. You can see it in
CXF, and adapt it<br/>
to your own purposes.</p>

<p>If you've done much Eclipse configuration, you know that pathnames are a pain. Relative
pathnames<br/>
can't cross Eclipse projects. Anything you can wire up via classpath is easier than anything
<br/>
wired by pathname. Thus the following scheme.</p>

<p>Step 1: A project to contain the common files.</p>

<p>CXF has a 'cxf-buildtools' project. It contains files for the tools. For each tool,
there<br/>
are two files: the XML file that configures the tool (name ends with .xml), and the more-or-less<br/>
XML file that Eclipse knows how to read to configure the Eclipse plugin. These files all live<br/>
in src/main/resources. When the builttools project builds, it just copies them to target<br/>
and bundles them into a JAR file.</p>

<p>Step 2: Maven plugins use the files.</p>

<p>The Maven plugins, of course, feed the same core XML files to the tools. By making
the buildtools artifact<br/>
a dependency of the Maven checkstyle and PMD plugins, the files become available by classpath.<br/>
This happens in the parent POM (parent/pom.xml) so that it is set up for all of the projects.</p>

<p>Step 3: Eclipse</p>

<p>Eclipse is configured via a collection of files that live in the<br/>
.settings directories of the workspace and the individual<br/>
projects. Each plugin defines the format of its settings. None of them<br/>
are documented: it's all reverse engineering.</p>

<p>In the top level POM, there is a profile called 'setup.eclipse'. It<br/>
uses a combination of ant, xslt, and the 'copy' task to create all of the desired settings
files.<br/>
Some of them are created by copying or modifying templates in etc/eclipse.</p>

<p>Eventually, setup.eclipse runs the Maven eclipse:eclipse goal to do the vanilla work<br/>
of creating .classpath and .project files for each of the projects.</p>
     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/CXF/Connecting+Maven%2C+Eclipse%2C+Checkstyle%2C+and+PMD">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=105238&revisedVersion=2&originalVersion=1">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/CXF/Connecting+Maven%2C+Eclipse%2C+Checkstyle%2C+and+PMD?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message