つかびーの技術日記

(情報)工学修士, 元SIer SE, 現Web系 SEの技術blogです。Scala, Java, JS, TS, Python, Ruby, AWS, GCPあたりが好きです。

Maven enforcerのEnforcer rules have failed

   

最近はScalaデベロッパーなのでビルドツールはsbtを使っているのですが、やはりたまにmavenにお目にかかるときがあります。MavenのOSSをビルドするから、という理由なのですが。

local環境ではmvn deployが通っても、なぜかCircleCI上では通らない。こういうエラーが出ます。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (enforce-versions) on project spark-parent_2.10: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [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/MojoExecutionException

Maven enforcerというのが失敗しています。Maven enforcerはJavaやMavenなどのバージョンの制約を定義して、意図しないビルドを防ぐものです。

具体的には例えばこれ。

https://github.com/cloudera/spark/blob/cdh5-1.6.0_5.8.2/pom.xml#L1931-L1933

mavenのversionを制限してます。

実際にエラーのところでLook above for specific messagesと言っているので、少し上のログを見ると・・・

[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireMavenVersion failed with message:
Detected Maven Version: 3.2.5 is not in the allowed range 3.3.3.

CircleCI上のmavenのversionが3.2.5で、pom.xmlの方は3.3.3を要求してるからNGということでした。簡単ですね。

強制的に無視したい場合は-Denforcer.skip=trueをmvnコマンドにつければOKです。うなるかわかりませんけども。

以上です

 - ライブラリ , ,