cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] Apache CXF > Connecting Maven, Eclipse, Checkstyle, and PMD
Date Tue, 14 Jul 2009 13:02:00 GMT
    <base href="">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CXF&amp;forWysiwyg=true"
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="">Connecting
Maven, Eclipse, Checkstyle, and PMD</a></h2>
     <h4>Page <b>edited</b> by             <a href="">Benson
     <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
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
can't cross Eclipse projects. Anything you can wire up via classpath is easier than anything
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,
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
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 id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href=""
class="grey">Change Notification Preferences</a>

       <a href="">View
       <a href="">View
       <a href=";showCommentArea=true#addcomment">Add

View raw message