Browse Source

Run checkstyle with Maven

Change-Id: I8590d2161d027827a5037f0b371ec620cea61733
tags/7.7.0.alpha2
Henri Sara 8 years ago
parent
commit
d05dbeb873

checkstyle/header → buildhelpers/src/main/resources/checkstyle/header View File


checkstyle/import-control.xml → buildhelpers/src/main/resources/checkstyle/import-control.xml View File


checkstyle/vaadin-checkstyle.xml → buildhelpers/src/main/resources/checkstyle/vaadin-checkstyle.xml View File

<module name="IllegalImport" /> <!-- defaults to sun.* packages --> <module name="IllegalImport" /> <!-- defaults to sun.* packages -->
<module name="RedundantImport" /> <module name="RedundantImport" />
<module name="UnusedImports" /> <module name="UnusedImports" />
<!--
<module name="ImportControl"> <module name="ImportControl">
<property name="file" value="${checkstyle.importControl.file}" /> <property name="file" value="${checkstyle.importControl.file}" />
<property name="severity" value="error" /> <property name="severity" value="error" />
</module> </module>
-->


<!-- Checks for Size Violations. --> <!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html --> <!-- See http://checkstyle.sf.net/config_sizes.html -->

+ 1
- 26
common.xml View File

<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project name="common" basedir="." default="checkstyle" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<project name="common" basedir="." default="" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">


<tstamp> <tstamp>
<format property="build.date" pattern="yyyy-MM-dd" /> <format property="build.date" pattern="yyyy-MM-dd" />
<ivy:cachepath pathid="taskdefs.classpath" conf="taskdefs" /> <ivy:cachepath pathid="taskdefs.classpath" conf="taskdefs" />
<taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml" classpathref="taskdefs.classpath" /> <taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml" classpathref="taskdefs.classpath" />



<!-- Checkstyle conf -->
<property name="cs.dir" location="${vaadin.basedir}/checkstyle" />
<property name="cs.xml" location="${cs.dir}/vaadin-checkstyle.xml" />
<property name="cs.header-file" location="${cs.dir}/header" />
<property name="cs.import-control-file" location="${cs.dir}/import-control.xml" />
<taskdef resource="checkstyletask.properties" uri="antlib:com.puppycrawl.tools.checkstyle" classpathref="taskdefs.classpath" />

<target name="checkstyle">
<fail unless="result.dir" message="No result.dir parameter given" />
<fail unless="cs.src" message="No cs.src parameter given" />
<property name="result.dir.full" location="${result.dir}" />
<mkdir dir="${result.dir}" />
<echo>##teamcity[importData type='checkstyle' path='${result.dir.full}/checkstyle-errors.xml']</echo>
<cs:checkstyle config="${cs.xml}" failOnViolation="false">
<fileset dir="${cs.src}" includes="**/*.java">
<exclude name="com/vaadin/sass/internal/parser/Parser.java" />
<exclude name="com/vaadin/sass/internal/parser/ParserConstants.java" />
<exclude name="com/vaadin/sass/internal/parser/ParserTokenManager.java" />
</fileset>
<formatter type="xml" toFile="${result.dir}/checkstyle-errors.xml" />
<property key="checkstyle.header.file" file="${cs.header-file}" />
<property key="checkstyle.importControl.file" file="${cs.import-control-file}" />
</cs:checkstyle>
</target>
</project> </project>

+ 33
- 1
pom.xml View File





<modules> <modules>
<module>all</module>
<module>buildhelpers</module> <module>buildhelpers</module>
<module>shared</module> <module>shared</module>
<module>push</module> <module>push</module>
<module>widgets</module> <module>widgets</module>
<module>uitest</module> <module>uitest</module>
<module>liferay</module> <module>liferay</module>
<module>all</module>
<!-- Nexus staging bug needs the last module to be deployed. --> <!-- Nexus staging bug needs the last module to be deployed. -->
<module>bom</module> <module>bom</module>
</modules> </modules>
<artifactId>vaadin-maven-plugin</artifactId> <artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.plugin.version}</version> <version>${vaadin.plugin.version}</version>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
</plugin>
<plugin> <plugin>
<groupId>org.eclipse.m2e</groupId> <groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId> <artifactId>lifecycle-mapping</artifactId>
</pluginManagement> </pluginManagement>


<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-buildhelpers</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Needed because of a JavadocMethodCheck bug in 6.11 -->
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>6.17</version>
</dependency>
</dependencies>
<configuration>
<configLocation>checkstyle/vaadin-checkstyle.xml</configLocation>
<headerLocation>checkstyle/header</headerLocation>
<encoding>UTF-8</encoding>
<consoleOutput>false</consoleOutput>
<failsOnError>false</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
</plugin>

<!-- Unpacked Dependencies as resource --> <!-- Unpacked Dependencies as resource -->
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>

+ 1
- 4
uitest/build.xml View File

<fail unless="result.dir" message="No result.dir parameter given" /> <fail unless="result.dir" message="No result.dir parameter given" />
<delete dir="${result.dir}" /> <delete dir="${result.dir}" />
</target> </target>
<target name="checkstyle">
<echo>Checkstyle is disabled for uitest for now</echo>
</target>
<target name="test" depends="checkstyle">
<target name="test">
</target> </target>


<target name="test-testbench" depends="clean-testbench-errors" <target name="test-testbench" depends="clean-testbench-errors"

+ 7
- 0
uitest/pom.xml View File

<skip>true</skip> <skip>true</skip>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins> </plugins>
<pluginManagement> <pluginManagement>
<plugins> <plugins>

Loading…
Cancel
Save