You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by yang xiao <sh...@gmail.com> on 2017/10/13 07:49:01 UTC

How to checkstyle based on storm_checkstyle xml

Hi,


I refer to https://issues.apache.org/jira/browse/STORM-2565 and want to use
checkstyle to get familiar with building Storm.

From Source Code, I understand that *storm-checkstyle *is custom developed
checkstyle project which is included in all projects as a dependency to the
Checkstyle Plugin. And validate phase will check style and generate
checkstyle-violation.xml in target folder.

 <plugin>
                    <!--To support checkstyle goals. For example: "mvn
checkstyle:checkstyle"-->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>2.17</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.storm</groupId>
                            <artifactId>storm-checkstyle</artifactId>
                            <version>${project.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <!-- If you change this, you should also update
the storm_checkstyle.xml file to be
                            based on the google_checks.xml from the version
of checkstyle you are choosing. -->
                            <version>8.2</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>validate</id>
                            <phase>validate</phase>
                            <configuration>

<configLocation>storm/storm_checkstyle.xml</configLocation>
                                <encoding>UTF-8</encoding>
                                <failOnViolation>true</failOnViolation>

<logViolationsToConsole>false</logViolationsToConsole>

<outputFile>target/checkstyle-violation.xml</outputFile>

<violationSeverity>warning</violationSeverity>
                            </configuration>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

When I execute* mvn validate*, it will use storm_checkstyle.xml to check
the code style and generate corresponding checkstyle-violation.xml in target
 folder.

For examle, storm-rocketmq has no violation based on
https://issues.apache.org/jira/browse/STORM-2594

But when I execute mvn checkstyle:checkstyle, it will use sun-checks.xml.



>\storm\external\storm-rocketmq>mvn checkstyle:checkstyle

[INFO] Scanning for projects...
[INFO]
[INFO]
------------------------------------------------------------------------
[INFO] Building storm-rocketmq 2.0.0-SNAPSHOT
[INFO]
------------------------------------------------------------------------
[WARNING] The POM for org.apache.logging.log4j:log4j-api:jar:2.8.2 is
invalid, transitive dependencies (if any) will not be available, enable
debug logging for more details
[WARNING] The POM for org.apache.logging.log4j:log4j-core:jar:2.8.2 is
invalid, transitive dependencies (if any) will not be available, enable
debug logging for more details
[WARNING] The POM for org.apache.logging.log4j:log4j-slf4j-impl:jar:2.8.2
is invalid, transitive dependencies (if any) will not be available, enable
debug logging for more details
[INFO]
[INFO] --- maven-checkstyle-plugin:2.17:checkstyle (default-cli) @
storm-rocketmq ---
[INFO] *There are 383 errors reported by Checkstyle 8.2 with sun_checks.xml
ruleset.*
[WARNING] Unable to locate Source XRef to link to - DISABLED
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 5.992 s
[INFO] Finished at: 2017-10-13T15:44:47+08:00
[INFO] Final Memory: 29M/292M
[INFO]
------------------------------------------------------------------------

How could I use checkstyle:checkstyle or checkstyle:check command based on
storm_checkstyle.xml?

Re: How to checkstyle based on storm_checkstyle xml

Posted by Stig Rohde Døssing <st...@gmail.com>.
I want to say that this is a known issue with checkstyle:check, when you
run the goals directly they don't pick up the configuration from the Storm
pom. As you noted you can use mvn validate instead.

2017-10-13 10:28 GMT+02:00 Jungtaek Lim <ka...@gmail.com>:

> Hi,
>
> It depends on storm-checkstyle artifact which needs to be installed locally
> and manually. (Maybe we would want to publish it to maven repo. and depends
> on it.)
> Could you run "mvn clean install -DskipTests" to install storm-checkstyle
> module to your local maven directory and try again?
>
> Thanks,
> Jungtaek Lim (HeartSaVioR)
>
> 2017년 10월 13일 (금) 오후 4:49, yang xiao <sh...@gmail.com>님이 작성:
>
> > Hi,
> >
> >
> > I refer to https://issues.apache.org/jira/browse/STORM-2565 and want to
> > use
> > checkstyle to get familiar with building Storm.
> >
> > From Source Code, I understand that *storm-checkstyle *is custom
> developed
> > checkstyle project which is included in all projects as a dependency to
> the
> > Checkstyle Plugin. And validate phase will check style and generate
> > checkstyle-violation.xml in target folder.
> >
> >  <plugin>
> >                     <!--To support checkstyle goals. For example: "mvn
> > checkstyle:checkstyle"-->
> >                     <groupId>org.apache.maven.plugins</groupId>
> >                     <artifactId>maven-checkstyle-plugin</artifactId>
> >                     <version>2.17</version>
> >                     <dependencies>
> >                         <dependency>
> >                             <groupId>org.apache.storm</groupId>
> >                             <artifactId>storm-checkstyle</artifactId>
> >                             <version>${project.version}</version>
> >                         </dependency>
> >                         <dependency>
> >                             <groupId>com.puppycrawl.tools</groupId>
> >                             <artifactId>checkstyle</artifactId>
> >                             <!-- If you change this, you should also
> update
> > the storm_checkstyle.xml file to be
> >                             based on the google_checks.xml from the
> version
> > of checkstyle you are choosing. -->
> >                             <version>8.2</version>
> >                         </dependency>
> >                     </dependencies>
> >                     <executions>
> >                         <execution>
> >                             <id>validate</id>
> >                             <phase>validate</phase>
> >                             <configuration>
> >
> > <configLocation>storm/storm_checkstyle.xml</configLocation>
> >                                 <encoding>UTF-8</encoding>
> >                                 <failOnViolation>true</failOnViolation>
> >
> > <logViolationsToConsole>false</logViolationsToConsole>
> >
> > <outputFile>target/checkstyle-violation.xml</outputFile>
> >
> > <violationSeverity>warning</violationSeverity>
> >                             </configuration>
> >                             <goals>
> >                                 <goal>check</goal>
> >                             </goals>
> >                         </execution>
> >                     </executions>
> >                 </plugin>
> >
> > When I execute* mvn validate*, it will use storm_checkstyle.xml to check
> > the code style and generate corresponding checkstyle-violation.xml in
> > target
> >  folder.
> >
> > For examle, storm-rocketmq has no violation based on
> > https://issues.apache.org/jira/browse/STORM-2594
> >
> > But when I execute mvn checkstyle:checkstyle, it will use sun-checks.xml.
> >
> >
> >
> > >\storm\external\storm-rocketmq>mvn checkstyle:checkstyle
> >
> > [INFO] Scanning for projects...
> > [INFO]
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Building storm-rocketmq 2.0.0-SNAPSHOT
> > [INFO]
> > ------------------------------------------------------------------------
> > [WARNING] The POM for org.apache.logging.log4j:log4j-api:jar:2.8.2 is
> > invalid, transitive dependencies (if any) will not be available, enable
> > debug logging for more details
> > [WARNING] The POM for org.apache.logging.log4j:log4j-core:jar:2.8.2 is
> > invalid, transitive dependencies (if any) will not be available, enable
> > debug logging for more details
> > [WARNING] The POM for org.apache.logging.log4j:
> log4j-slf4j-impl:jar:2.8.2
> > is invalid, transitive dependencies (if any) will not be available,
> enable
> > debug logging for more details
> > [INFO]
> > [INFO] --- maven-checkstyle-plugin:2.17:checkstyle (default-cli) @
> > storm-rocketmq ---
> > [INFO] *There are 383 errors reported by Checkstyle 8.2 with
> sun_checks.xml
> > ruleset.*
> > [WARNING] Unable to locate Source XRef to link to - DISABLED
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] BUILD SUCCESS
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Total time: 5.992 s
> > [INFO] Finished at: 2017-10-13T15:44:47+08:00
> > [INFO] Final Memory: 29M/292M
> > [INFO]
> > ------------------------------------------------------------------------
> >
> > How could I use checkstyle:checkstyle or checkstyle:check command based
> on
> > storm_checkstyle.xml?
> >
>

Re: How to checkstyle based on storm_checkstyle xml

Posted by Jungtaek Lim <ka...@gmail.com>.
Hi,

It depends on storm-checkstyle artifact which needs to be installed locally
and manually. (Maybe we would want to publish it to maven repo. and depends
on it.)
Could you run "mvn clean install -DskipTests" to install storm-checkstyle
module to your local maven directory and try again?

Thanks,
Jungtaek Lim (HeartSaVioR)

2017년 10월 13일 (금) 오후 4:49, yang xiao <sh...@gmail.com>님이 작성:

> Hi,
>
>
> I refer to https://issues.apache.org/jira/browse/STORM-2565 and want to
> use
> checkstyle to get familiar with building Storm.
>
> From Source Code, I understand that *storm-checkstyle *is custom developed
> checkstyle project which is included in all projects as a dependency to the
> Checkstyle Plugin. And validate phase will check style and generate
> checkstyle-violation.xml in target folder.
>
>  <plugin>
>                     <!--To support checkstyle goals. For example: "mvn
> checkstyle:checkstyle"-->
>                     <groupId>org.apache.maven.plugins</groupId>
>                     <artifactId>maven-checkstyle-plugin</artifactId>
>                     <version>2.17</version>
>                     <dependencies>
>                         <dependency>
>                             <groupId>org.apache.storm</groupId>
>                             <artifactId>storm-checkstyle</artifactId>
>                             <version>${project.version}</version>
>                         </dependency>
>                         <dependency>
>                             <groupId>com.puppycrawl.tools</groupId>
>                             <artifactId>checkstyle</artifactId>
>                             <!-- If you change this, you should also update
> the storm_checkstyle.xml file to be
>                             based on the google_checks.xml from the version
> of checkstyle you are choosing. -->
>                             <version>8.2</version>
>                         </dependency>
>                     </dependencies>
>                     <executions>
>                         <execution>
>                             <id>validate</id>
>                             <phase>validate</phase>
>                             <configuration>
>
> <configLocation>storm/storm_checkstyle.xml</configLocation>
>                                 <encoding>UTF-8</encoding>
>                                 <failOnViolation>true</failOnViolation>
>
> <logViolationsToConsole>false</logViolationsToConsole>
>
> <outputFile>target/checkstyle-violation.xml</outputFile>
>
> <violationSeverity>warning</violationSeverity>
>                             </configuration>
>                             <goals>
>                                 <goal>check</goal>
>                             </goals>
>                         </execution>
>                     </executions>
>                 </plugin>
>
> When I execute* mvn validate*, it will use storm_checkstyle.xml to check
> the code style and generate corresponding checkstyle-violation.xml in
> target
>  folder.
>
> For examle, storm-rocketmq has no violation based on
> https://issues.apache.org/jira/browse/STORM-2594
>
> But when I execute mvn checkstyle:checkstyle, it will use sun-checks.xml.
>
>
>
> >\storm\external\storm-rocketmq>mvn checkstyle:checkstyle
>
> [INFO] Scanning for projects...
> [INFO]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building storm-rocketmq 2.0.0-SNAPSHOT
> [INFO]
> ------------------------------------------------------------------------
> [WARNING] The POM for org.apache.logging.log4j:log4j-api:jar:2.8.2 is
> invalid, transitive dependencies (if any) will not be available, enable
> debug logging for more details
> [WARNING] The POM for org.apache.logging.log4j:log4j-core:jar:2.8.2 is
> invalid, transitive dependencies (if any) will not be available, enable
> debug logging for more details
> [WARNING] The POM for org.apache.logging.log4j:log4j-slf4j-impl:jar:2.8.2
> is invalid, transitive dependencies (if any) will not be available, enable
> debug logging for more details
> [INFO]
> [INFO] --- maven-checkstyle-plugin:2.17:checkstyle (default-cli) @
> storm-rocketmq ---
> [INFO] *There are 383 errors reported by Checkstyle 8.2 with sun_checks.xml
> ruleset.*
> [WARNING] Unable to locate Source XRef to link to - DISABLED
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 5.992 s
> [INFO] Finished at: 2017-10-13T15:44:47+08:00
> [INFO] Final Memory: 29M/292M
> [INFO]
> ------------------------------------------------------------------------
>
> How could I use checkstyle:checkstyle or checkstyle:check command based on
> storm_checkstyle.xml?
>