简体   繁体   English

Maven 插件问题:maven-enforcer-plugin:3.0.0-M3:enforce 有些 Enforcer 规则失败

[英]Problem with Maven plugin :maven-enforcer-plugin:3.0.0-M3:enforce Some Enforcer rules have failed

A little bit of context: Im working as a FE developer for an AEM project.一点背景信息:我是 AEM 项目的 FE 开发人员。 The project is a SPA AEM as cloud service.该项目是作为云服务的 SPA AEM。 I am running the author instance from the command line.我正在从命令行运行作者实例。

My pc specs are:我的电脑规格是:

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

For the AEM Project we are using对于我们正在使用的 AEM 项目

  • Java sdk 11 Java SDK 11
  • Maven 3.6.3 Maven 3.6.3

I have already set up everything, the path variables, JAVA_HOME, mvn.我已经设置好了一切,路径变量,JAVA_HOME,mvn。 All of them work fine, even trying to build other type of projects with "older" versions of AEM like 6.5 build perfectly.它们都运行良好,甚至尝试使用“旧”版本的 AEM 构建其他类型的项目,例如 6.5 构建完美。 I don't have a problem with them.我对他们没有问题。 But with this version of AEM I am getting this error但是使用此版本的 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

I've been searching in sites, some of the answers for this problem haven't work for me.我一直在网站上搜索,这个问题的一些答案对我不起作用。

  • I tried to run everything from the "gitbash" command line and I had the same problem.我尝试从“gitbash”命令行运行所有内容,但遇到了同样的问题。
  • I tried to change the version in the pom.xml, didnt work.我试图更改 pom.xml 中的版本,没有用。
  • I tried to build the project using eclipse IDE and all the build-in tools, I get an error that org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce is missing我尝试使用 Eclipse IDE 和所有内置工具构建项目,但收到错误org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce is missing
  • Disable firewall and antivirus, nope禁用防火墙和防病毒软件,不
  • Use other versions of maven like 3.8.2使用其他版本的 Maven,如 3.8.2
  • Delete the .m2 directory and download again all the plugins, not working删除.m2目录并重新下载所有插件,不起作用

One of many answers tell me to comment out the dispatcher module in the pom.xml and after I did that builds fine.许多答案之一告诉我在 pom.xml 中注释掉调度程序模块,然后我就可以正常构建。 Other is doing the same and upload the ui.apps/target/*.zip with the crx package manager I did it but im not sure if the result is the "best".其他人也在做同样的事情,并使用crx 包管理器上传ui.apps/target/*.zip我做到了,但我不确定结果是否是“最好的”。 To end, I installed the same project in a Mac Pro and i did without a problem.最后,我在 Mac Pro 中安装了相同的项目,并且没有出现问题。 I hope someone can help me with this.我希望有人能帮我解决这个问题。 Thanks for reading.谢谢阅读。

[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

The Maven Enforcer Plugin is checking for some files to have an specific checksum using requireFileChecksum rule Maven Enforcer 插件正在使用requireFileChecksum 规则检查某些文件是否具有特定checksum

Somewhere in your pom.xml the Enforcer Maven plugin should be declared, so you will be able to see the rule and the hash it is applying.在你的pom.xml的某个地方应该声明 Enforcer Maven 插件,这样你就可以看到规则和它应用的哈希。 This xml snippet is from the maven plugin documentation.这个 xml 片段来自 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>

Check that hash against the hash of the file of your filesystem.根据文件系统文件的哈希值检查该哈希值。 Maybe when you change aem version, you need to upgrade some of those files.也许当您更改aem版本时,您需要升级其中一些文件。

As discussed here: https://github.com/adobe/aem-guides-wknd/pull/202如此处所讨论: https : //github.com/adobe/aem-guides-wknd/pull/202

Adobe have reported the issue and the fix to Adobe AEM WKND project: Adobe 已经报告了 Adob​​e AEM WKND 项目的问题和修复:

Some Windows users experience a Maven enforcer issue where it appears that default dispatcher files have been modified.某些 Windows 用户遇到 Maven 执行器问题,其中似乎默认调度程序文件已被修改。 Unclear if this is a result of differences between Mac and Windows or something that occurs during the checkout process.不清楚这是否是 Mac 和 Windows 之间的差异或结帐过程中发生的某些事情的结果。 Most users simply want to install the code base to a local environment and this check is unnecessary.大多数用户只是想将代码库安装到本地环境中,这种检查是不必要的。 Removing the enforcement for windows builds.删除 Windows 构建的强制执行。

so you can :这样你就可以 :

Skips Dispatcher enforcement plugin for users on windows environments.为 Windows 环境中的用户跳过 Dispatcher 执行插件。

doing a change you dispatcher/pom.xml with the commit reported here:使用此处报告的提交对您的 dispatcher/pom.xml 进行更改:

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

replacing the line:更换线:

<goal>enforce</goal>

with:和:

<goal>display-info</goal>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM