Konfigurieren von Checkstyle in Eclipse ein maven Projekt automatisch

Ich habe ein maven-multi-Projekt, wenn ich ein neues eclipse-Projekt aus (durch M2E 1.0 "Checkout Maven-Projekt von SCM -) ich möchte, dass die eclipse-checkstyle-plugin ist konfiguriert für das Projekt automatisch.

Also ich habe die maven-eclipse-plugin im parent pom ist <pluginManagement> Abschnitt und konfiguriert zum generieren .checkstyle - Datei sowie die zusätzliche Projekt Natur CheckstyleNature. In der modul-poms habe ich den Namen des maven-eclipse-plugin in der build-Sektion. Aber wenn ich die Kasse-Projekt nichts passiert, die Datei wird nicht generiert, und die Natur wird nicht Hinzugefügt.

So, ich denke, ich mache etwas völlig falsch, aber wie wird es richtig gemacht?


Parent pom - plugin-management Abschnitt:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-eclipse-plugin</artifactId>
    <version>2.8</version>
    <configuration>
        <downloadSources>true</downloadSources>
        <downloadJavadocs>false</downloadJavadocs>
        <wtpversion>2.0</wtpversion>
        <additionalBuildcommands>
            <buildCommand>
                <name>org.eclipse.ajdt.core.ajbuilder</name>
                <arguments>
                    <aspectPath>org.springframework.aspects</aspectPath>
                </arguments>
            </buildCommand>
            <buildCommand>
                <name>org.springframework.ide.eclipse.core.springbuilder</name>
            </buildCommand>
        </additionalBuildcommands>
        <additionalProjectnatures>
            <projectnature>org.eclipse.ajdt.ui.ajnature</projectnature>
            <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
            <projectnature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</projectnature>
        </additionalProjectnatures>
        <additionalConfig>
            <file>
                <name>.checkstyle</name>
                <content>
<![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
  <fileset name="all" enabled="true" check-config-name="My Checkstyle rules" local="false">
    <file-match-pattern match-pattern="." include-pattern="true"/>
  </fileset>
  <filter name="FilesFromPackage" enabled="true">
    <filter-data value="target" />
    <filter-data value="src/main/resources"/>
    <filter-data value="src/test/java"/>
    <filter-data value="src/test/resources"/>
    <filter-data value="src/main/webapp" />
  </filter>
</fileset-config>
]]>
                </content>
            </file>
        </additionalConfig>
    </configuration>
</plugin>

Modul pom - plugins Abschnitt:

<plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-eclipse-plugin</artifactId>
</plugin>
InformationsquelleAutor Ralph | 2011-12-02
Schreibe einen Kommentar