次のpom.xmlファイルを作成しました。checkstyle警告/渋滞グラフを作成し、checkstyle警告があればビルド先読みを中止する必要があります。Jenkins/Maven checkstyle:pom.xmlでチェックしないでください
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>test</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.8</version>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
<configuration>
<configLocation>https://dustplanet.de/checkstyle.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.7</version>
</plugin>
</plugins>
</reporting>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugin</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<failOnViolation>true</failOnViolation>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
</plugin>
</plugins>
</build>
</project>
問題は、私はジェンキンスとMavenプロジェクトと、このMavenのゴールを構築する場合clean install
プロジェクトがビルドされますが、のCheckstyleプラグインが実行されません、です。だから私はを使った。 site
では、レポートと傾向グラフが作成されましたが、ビルドプロセスはまだ停止しません。その後、私はclean install site checkstyle:check -Dcheckstyle.config.location="https://dustplanet.de/checkstyle.xml"
を使用しました。ビルドプロセスは失敗しましたが、解析結果と傾向グラフにはcheckstyleエラーが表示されません。ターゲットディレクトリにレポートが作成されていますが、ジョブの構成が有効になります。これは最後のビルドのコンソール出力です:
Started by timer
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/workspace/MavenProject2
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url [email protected]:SysKit/SYSKIT.git # timeout=10
Fetching upstream changes from [email protected]:SysKit/SYSKIT.git
> git --version # timeout=10
using GIT_SSH to set credentials
> git fetch --tags --progress [email protected]:SysKit/SYSKIT.git +refs/heads/*:refs/remotes/origin/* +refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*
> git rev-parse origin/master^{commit} # timeout=10
Checking out Revision 11d0f4105661346b7577fa223fe0f4063572fb99 (origin/master)
Commit message: "test"
> git config core.sparsecheckout # timeout=10
> git checkout -f 11d0f4105661346b7577fa223fe0f4063572fb99
> git rev-list 11d0f4105661346b7577fa223fe0f4063572fb99 # timeout=10
Parsing POMs
Established TCP socket on 35703
[test] $ java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven33-agent-1.11.jar:/opt/maven/boot/plexus-classworlds-2.5.2.jar:/opt/maven/conf/logging jenkins.maven3.agent.Maven33Main /opt/maven /var/cache/jenkins/war/WEB-INF/lib/remoting-3.7.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven33-interceptor-1.11.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.11.jar 35703
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /var/lib/jenkins/workspace/MavenProject2/test/pom.xml site clean install checkstyle:check -Dcheckstyle.config.location=https://dustplanet.de/checkstyle.xml
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building test 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-site-plugin:3.3:site (default-site) @ test ---
[INFO] configuring report plugin org.apache.maven.plugins:maven-checkstyle-plugin:2.8
[INFO] configuring report plugin org.apache.maven.plugins:maven-project-info-reports-plugin:2.7
[INFO] Relativizing decoration links with respect to project URL: http://maven.apache.org
[INFO] Rendering site with org.apache.maven.skins:maven-default-skin:jar:1.0 skin.
[INFO] Generating "Checkstyle" report --- maven-checkstyle-plugin:2.8
[INFO]
[INFO] There are 1 checkstyle errors.
[WARNING] Unable to locate Source XRef to link to - DISABLED
[INFO] Generating "About" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Plugin Management" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Distribution Management" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Dependency Information" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Source Repository" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Mailing Lists" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Issue Tracking" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Continuous Integration" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Project Plugins" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Project License" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Project Team" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Project Summary" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Dependencies" report --- maven-project-info-reports-plugin:2.7
[CHECKSTYLE] Parsing file /var/lib/jenkins/workspace/MavenProject2/test/target/checkstyle-result.xml
[CHECKSTYLE] Successfully parsed file /var/lib/jenkins/workspace/MavenProject2/test/target/checkstyle-result.xml of module test with 1 unique warning and 0 duplicates.
[CHECKSTYLE] Computing warning deltas based on reference build #226
[JENKINS] Archiving site from /var/lib/jenkins/workspace/MavenProject2/test/target/site to /var/lib/jenkins/jobs/MavenProject2/site
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ test ---
[INFO] Deleting /var/lib/jenkins/workspace/MavenProject2/test/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/MavenProject2/test/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ test ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /var/lib/jenkins/workspace/MavenProject2/test/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/MavenProject2/test/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ test ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /var/lib/jenkins/workspace/MavenProject2/test/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ test ---
[INFO] Surefire report directory: /var/lib/jenkins/workspace/MavenProject2/test/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running test.test.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.052 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ test ---
[INFO] Building jar: /var/lib/jenkins/workspace/MavenProject2/test/target/test-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ test ---
[INFO] Installing /var/lib/jenkins/workspace/MavenProject2/test/target/test-0.0.1-SNAPSHOT.jar to /var/lib/jenkins/.m2/repository/test/test/0.0.1-SNAPSHOT/test-0.0.1-SNAPSHOT.jar
[INFO] Installing /var/lib/jenkins/workspace/MavenProject2/test/pom.xml to /var/lib/jenkins/.m2/repository/test/test/0.0.1-SNAPSHOT/test-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] --- maven-checkstyle-plugin:2.17:check (default-cli) @ test ---
[INFO] There is 1 error reported by Checkstyle 6.11.2 with https://dustplanet.de/checkstyle.xml ruleset.
[ERROR] src/main/java/test/test/App.java:[11,43] (whitespace) WhitespaceAround: '{' is not preceded with whitespace.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 36.200 s
[INFO] Finished at: 2017-08-17T17:47:53+02:00
[INFO] Final Memory: 44M/106M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (default-cli) on project test: You have 1 Checkstyle violation. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[JENKINS] Archiving /var/lib/jenkins/workspace/MavenProject2/test/pom.xml to test/test/0.0.1-SNAPSHOT/test-0.0.1-SNAPSHOT.pom
[JENKINS] Archiving /var/lib/jenkins/workspace/MavenProject2/test/target/test-0.0.1-SNAPSHOT.jar to test/test/0.0.1-SNAPSHOT/test-0.0.1-SNAPSHOT.jar
Not sending mail to unregistered user [email protected]
An attempt to send an e-mail to empty list of recipients, ignored.
channel stopped
[ANALYSIS-COLLECTOR] Computing warning deltas based on reference build #226
Not sending mail to unregistered user [email protected]
An attempt to send an e-mail to empty list of recipients, ignored.
Finished: FAILURE
誰かが私が間違っていたことを知っていますか?
EDIT 1 これで、この警告が表示されるので、ビルドシーケンスのcheckstyleプラグインが正しく動作しないことがわかりました。私は、ビルド順序でのCheckstyleプラグインを入れたなら、彼らはのみ発生
[INFO] Scanning for projects...
[WARNING] The POM for org.apache.maven.plugin:maven-checkstyle-plugin:jar:2.17 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugin:maven-checkstyle-plugin:2.17: Plugin org.apache.maven.plugin:maven-checkstyle-plugin:2.17 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugin:maven-checkstyle-plugin:jar:2.17 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building test 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.apache.maven.plugin:maven-checkstyle-plugin:jar:2.17 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugin:maven-checkstyle-plugin:2.17: Plugin org.apache.maven.plugin:maven-checkstyle-plugin:2.17 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugin:maven-checkstyle-plugin:jar:2.17 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
は、レポートのシーケンスでのCheckstyleプラグインが正常に動作します。どうすればこの警告を解決できますか?
EDIT 2
OK問題は、私は<groupId>org.apache.maven.plugin</groupId>
にプラグインの後に "s" を忘れてしまったということでした。プラグインはまだ実行されませんが、私は今jenkinsのcheckstyleプラグインで不安定または不安定なビルドとしてマークします。それにもかかわらず、私はこの可能性を最初にやったに違いない。あなたは下のリンクを参照することができます多くのため
<project>
...
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
...
</project>
:
何'[エラー] src/main/java/test/test/App.java:[11,43](空白)WhitespaceAround: '{'は先行しません空白を使って.... '..? – khmarbaise
チェックスタイルエラーが発生した場合にビルドプロセスが失敗することを望みますが、チェックスタイルの傾向グラフとジェンキンの分析レポートが正しく更新されるようにしたいと考えています。今は、ビルドプロセスが途切れたり、トレンドグラフが正しく更新されているが、どちらも同時に更新されていないことがわかった。申し訳ありませんが、私のことを理解するのが難しい場合は、私も新しいjenkinsとmaven、私の英語isntも最高です。 – seb2704