Hi,

I'm using maven 3.0.2 and trying to follow the maven tutorial "Using
Custom Developed Checkstyle Checks"
(http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-developed-checkstyle.html).

It works with long module name(1) but doesn't work with short module name(2):

checkstyle.xml

<?xml version="1.0"?><!DOCTYPE module PUBLIC
    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd";>

<module name="Checker">
  <module name="TreeWalker">

    <!-- (1) It works. -->
    <module name="com.objectfanatics.checkstyle.checks.MethodLimit" />

    <!-- (2) It doesn't work -->
    <module name="MethodLimit" />

  </module>
</module>

Does anyone has any idea?

Regards,
Makoto Sato

-------------------------
error message
-------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-site-plugin:3.0-beta-3:site
(default-site) on project mincheckstyleenv: Error during page
generation: Error rendering Maven report: Failed during checkstyle
configuration: cannot initialize module TreeWalker - Unable to
instantiate MethodLimit: Unable to instantiate MethodLimitCheck ->
[Help 1]


-------------------------
pom.xml
-------------------------
  ...
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-checkstyle-plugin</artifactId>
  <version>2.6</version>
  <dependencies>
    <dependency>
      <groupId>com.objectfanatics.checkstyle</groupId>
      <artifactId>checks</artifactId>
      <version>0.0.1-SNAPSHOT</version>
    </dependency>
  </dependencies>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-site-plugin</artifactId>
  <version>3.0-beta-3</version>
  <configuration>
    <inputEncoding>UTF-8</inputEncoding>
    <outputEncoding>UTF-8</outputEncoding>
    <reportPlugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jxr-plugin</artifactId>
        <version>2.2</version>
        <configuration>
          <inputEncoding>UTF-8</inputEncoding>
          <outputEncoding>UTF-8</outputEncoding>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>2.6</version>
        <configuration>
          <configLocation>checkstyle.xml</configLocation>
          
<packageNamesLocation>com/objectfanatics/checkstyle/checks/packagenames.xml</packageNamesLocation>
        </configuration>
      </plugin>
    </reportPlugins>
  </configuration>
</plugin>
  ...

-------------------------
checks-0.0.1-SNAPSHOT.jar
-------------------------
  - com
    - objectfanatics
      - checkstyle
        - checks
          - MethodLimitCheck.class
          - packagenames.xml
  - META-INF
    - MANIFEST.MF
    - maven
      - com.objectfanatics.checkstyle
        - checks
          - pom.properties
          - pom.xml

-------------------------
packagenames.xml
-------------------------
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE checkstyle-packages PUBLIC
    "-//Puppy Crawl//DTD Package Names 1.0//EN"
    "http://www.puppycrawl.com/dtds/packages_1_0.dtd";>

<checkstyle-packages>
  <package name="com.objectfanatics.checkstyle.checks" />
  <package name="com.puppycrawl.tools.checkstyle">
    <package name="checks">
      <package name="annotation" />
      <package name="blocks" />
      <package name="coding" />
      <package name="design" />
      <package name="duplicates" />
      <package name="header" />
      <package name="imports" />
      <package name="indentation" />
      <package name="javadoc" />
      <package name="metrics" />
      <package name="modifier" />
      <package name="naming" />
      <package name="regexp" />
      <package name="sizes" />
      <package name="whitespace" />
    </package>
    <package name="filters" />
  </package>
</checkstyle-packages>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to