【问题标题】:Problem with Maven plugin :maven-enforcer-plugin:3.0.0-M3:enforce Some Enforcer rules have failedMaven 插件问题:maven-enforcer-plugin:3.0.0-M3:enforce 一些 Enforcer 规则失败
【发布时间】:2021-10-23 08:29:05
【问题描述】:

一点上下文: 我是 AEM 项目的 FE 开发人员。该项目是作为云服务的 SPA AEM。我正在从命令行运行作者实例。

我的电脑规格是:

  • CPU:Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz 3.00 GHz
  • 内存:24.0 GB
  • 固态硬盘:476 GB
  • 操作系统:Windows 10 专业版

对于我们正在使用的 AEM 项目

  • Java SDK 11
  • Maven 3.6.3

我已经设置了一切,路径变量,JAVA_HOME,mvn。所有这些都可以正常工作,甚至尝试使用“旧”版本的 AEM(如 6.5)构建其他类型的项目也可以完美构建。我对他们没有问题。但是使用此版本的 AEM,我收到此错误

[WARNING] Rule 9: org.apache.maven.plugins.enforcer.RequireFileChecksum failed with message:
There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/renders/default_renders.any
[WARNING] Rule 10: org.apache.maven.plugins.enforcer.RequireFileChecksum failed with message:
There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/virtualhosts/default_virtualhosts.any
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for xxxxxx 1.0.0-SNAPSHOT:
[INFO]
[INFO] xxxxxx ................................. SUCCESS [  0.270 s]
[INFO] xxxxxx - Core .......................... SUCCESS [ 59.232 s]
[INFO] xxxxxx - UI Frontend ................... SUCCESS [ 19.876 s]
[INFO] xxxxxx - UI Frontend React ............. SUCCESS [ 39.613 s]
[INFO] xxxxxx - Repository Structure Package .. SUCCESS [  0.991 s]
[INFO] xxxxxx - UI apps ....................... SUCCESS [ 12.990 s]
[INFO] xxxxxx - UI content .................... SUCCESS [  4.178 s]
[INFO] xxxxxx - UI config ..................... SUCCESS [  0.314 s]
[INFO] xxxxxx - All ........................... SUCCESS [  1.052 s]
[INFO] xxxxxx - Integration Tests ............. SUCCESS [ 12.166 s]
[INFO] xxxxxx - Dispatcher .................... FAILURE [  0.030 s]
[INFO] xxxxxx - UI Tests ...................... SKIPPED
[INFO] xxxxxx - Project Analyser .............. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:34 min
[INFO] Finished at: 2021-08-22T15:11:20-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce (enforce-checksum-of-immutable-files) on project xxxxxxx.dispatcher.cloud: 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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :xxxxxx.dispatcher.cloud

我一直在网站上搜索,这个问题的一些答案对我不起作用。

  • 我尝试从“gitbash”运行所有内容 命令行和我有同样的问题。
  • 我尝试更改 pom.xml 中的版本,没有成功。
  • 我尝试使用 Eclipse IDE 和所有内置工具构建项目,我收到一个错误 org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce 不见了
  • 禁用防火墙和防病毒软件,不行
  • 使用其他版本的 maven,例如 3.8.2
  • 删除.m2目录,重新下载所有插件,无效

许多答案中的一个告诉我在 pom.xml 中注释掉调度程序模块,并且在我这样做之后构建良好。其他人也在这样做,并使用 crx 包管理器上传 ui.apps/target/*.zip 我做到了,但我不确定结果是否是“最好的” ”。 最后,我在 Mac Pro 中安装了相同的项目,并且没有问题。我希望有人可以帮助我。感谢阅读。

【问题讨论】:

  • 这是个好问题,为什么人们倾向于-1呢?

标签: java maven aem java-11


【解决方案1】:
[WARNING] Rule 9: org.apache.maven.plugins.enforcer.RequireFileChecksum failed with message:
There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/renders/default_renders.any

Maven Enforcer Plugin 正在使用requireFileChecksum rule 检查某些文件是否具有特定的checksum

应该在pom.xml 的某个地方声明 Enforcer Maven 插件,这样您就可以看到它应用的规则和散列。这个 xml sn-p 来自 maven 插件文档。

<requireTextFileChecksum>
  <file>E:\java-workspace\apache-maven-enforcer\maven-enforcer\target\checkout\enforcer-rules\target\classes/foo.txt</file>
  <checksum>d41d8cd98f00b204e9800998ecf8427e</checksum>
  <type>md5</type>
</requireTextFileChecksum>

根据文件系统文件的哈希值检查该哈希值。也许当您更改aem 版本时,您需要升级其中的一些文件。

【讨论】:

  • 最新的 AEM 原型(项目结构)在 dispatcher 模块中有新文件,这些文件必须保持相同的内容(它们不能更改)。为了保护这一点,Adobe 想出了一个办法来检查这些文件的校验和。问题可能是您使用与 UTF-8 不同的标准(如 ISO)相同的文件,这会为您提供不同的校验和。如果您根本没有更改这些文件,请检查编辑器的编码类型。否则,将这些更改恢复到原始状态。
【解决方案2】:

这里讨论过:https://github.com/adobe/aem-guides-wknd/pull/202

Adobe 已向 Adob​​e AEM WKND 项目报告了该问题和修复:

一些 Windows 用户遇到 Maven 强制执行器问题,默认调度程序文件似乎已被修改。不清楚这是否是由于 Mac 和 Windows 之间的差异或结帐过程中发生的某些事情造成的。大多数用户只是想将代码库安装到本地环境中,而无需进行此检查。删除 Windows 构建的强制执行。

所以你可以:

为 Windows 环境中的用户跳过 Dispatcher 强制插件。

改变你的 dispatcher/pom.xml 此处报告的提交:

https://github.com/adobe/aem-guides-wknd/pull/202/commits/bebcf5d2236c75a95055d5ff71ea58f66379f271

换行:

<goal>enforce</goal>

与:

<goal>display-info</goal>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-08
    • 1970-01-01
    • 2023-04-07
    相关资源
    最近更新 更多