Jenkinsの新規ジョブ作成で、ビルドやCheckstyleをAntでビルドします。
以下はcompileしてからcheckstyleを実行する例です。
Jenkins\workspace\プロジェクト名\配下にbuild.xmlを配置します。
「ビルド後の処理」でCheckstyle警告の集計を選択します。
修正するファイル配置場所を適当に記述します。xml形式にします。
workspace\プロジェクト名\がデフォルト位置になります。
checkstyleのbuild.xmlの例です。
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<taskdef resource="checkstyletask.properties" classpath="${lib.dir}/checkstyle-all-4.4.jar" /> <target name="checkstyle" description="Run checkstyle"> <!-- checkstyle定義ファイル --> <checkstyle config="${checkstyle.conf.dir}/confrage.checkstyle.xml" failOnViolation="false"> <fileset dir="${compile.src}" includes="**/*.java" /> <property key="checkstyle.header.file" value="${checkstyle.conf.dir}/java.header" /> <property key="checkstyle.suppressions.file" value="${checkstyle.conf.dir}/suppressions.xml" /> <property key="checkstyle.importcontrol.file" value="${checkstyle.conf.dir}/import-control.xml" /> <formatter type="xml" toFile="${checkstyle.output.dir}/checkstyle_report.xml" /> </checkstyle> </target> |
checkstyletask.propertiesは、checkstyle-all-4.4.jarファイル内に存在するファイルです。これをresourceで指定する必要があります。
「Checkstyle警告」というリンクが表示されるのでクリックすると、「Checkstyle警告の推移」が表示されます。
KHI入社して退社。今はCONFRAGEで正社員です。関西で140-170/80~120万から受け付けております^^
得意技はJS(ES6),Java,AWSの大体のリソースです
コメントはやさしくお願いいたします^^
座右の銘は、「狭き門より入れ」「願わくは、我に七難八苦を与えたまえ」です^^