How to set up checkstyle confuguration for Ant in Hudson?

How to configure checkstyle (in Ant nt Maven)? I tried a little, but I did not get the reports properly. Here is my Ant script.

<target name="checkStyle"> <taskdef resource="checkstyletask.properties"> <classpath refid="compile.class.pathtest"/> </taskdef> <checkstyle config="${source.code.dir}/config/sun_checks.xml"> <fileset dir="${base.working.dir}/JavaFolder"> <include name="**/*.java"/> </fileset> <formatter type="plain"/> <formatter type="xml" toFile="checkstyle-result.xml"/> </checkstyle> </target> <path id="compile.class.pathtest"> <pathelement location="${checkstyle.dir}/checkstyle-5.5-all.jar"/> <pathelement location="${checkstyle.dir}/checkstyle-5.5.jar"/> <pathelement location="${checkstyle.dir}/pmd-3.9.jar"/> <pathelement location="${checkstyle.dir}/asm-3.0.jar"/> <pathelement location="${checkstyle.dir}/backport-util-concurrent-2.1.jar"/> <pathelement location="${checkstyle.dir}/jaxen-1.1-beta-10.jar"/> <pathelement location="${checkstyle.dir}/saxpath-1.0-FCS.jar"/> </path> 

What is sun_checks.xml file? I downloaded and saved in the above folder. When you start the build, it shows some warnings and errors. Later it looks like this.

STRICTLY MALFUNCTIONAL

C: \ server \ build.xml: 9725: The following error occurred while executing this line: C: \ server \ build.xml: 3838: 56 errors and 27599 warnings were received.

Could you advise me how to solve this?

thanks

+4
source share
1 answer

The sun_checks.xml file contains the checkstyle configurations , that is, all the rules that should be applied when evaluating the source code.

Your build failed because checkstyle detected an error.

You can set the failOnViolation property to false to avoid this. This property defaults to true if it is not set.

 <checkstyle config="${source.code.dir}/config/sun_checks.xml" failOnViolation="false"> <fileset dir="${base.working.dir}/JavaFolder"> <include name="**/*.java"/> </fileset> <formatter type="plain"/> <formatter type="xml" toFile="checkstyle-result.xml"/> </checkstyle> 
+6
source

Source: https://habr.com/ru/post/1382431/


All Articles