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

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

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

+ 1
- 26
common.xml View File

@@ -1,5 +1,5 @@
<?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>
<format property="build.date" pattern="yyyy-MM-dd" />
@@ -14,29 +14,4 @@
<ivy:cachepath pathid="taskdefs.classpath" conf="taskdefs" />
<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>

+ 33
- 1
pom.xml View File

@@ -76,7 +76,6 @@


<modules>
<module>all</module>
<module>buildhelpers</module>
<module>shared</module>
<module>push</module>
@@ -88,6 +87,7 @@
<module>widgets</module>
<module>uitest</module>
<module>liferay</module>
<module>all</module>
<!-- Nexus staging bug needs the last module to be deployed. -->
<module>bom</module>
</modules>
@@ -170,6 +170,11 @@
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
</plugin>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
@@ -204,6 +209,33 @@
</pluginManagement>

<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 -->
<plugin>
<groupId>org.codehaus.mojo</groupId>

+ 1
- 4
uitest/build.xml View File

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

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

+ 7
- 0
uitest/pom.xml View File

@@ -349,6 +349,13 @@
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>

Loading…
Cancel
Save