Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. The project is a SPA AEM as cloud service. 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
  • RAM: 24.0 GB
  • SSD: 476 GB
  • OS: Windows 10 Pro

For the AEM Project we are using

  • Java sdk 11
  • Maven 3.6.3

I have already set up everything, the path variables, 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. I don't have a problem with them. But with this version of AEM I am getting this error

[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.
  • I tried to change the version in the pom.xml, didnt work.
  • 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
  • Disable firewall and antivirus, nope
  • Use other versions of maven like 3.8.2
  • Delete the .m2 directory and download again all the plugins, not working

One of many answers tell me to comment out the dispatcher module in the pom.xml and after I did that builds fine. 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". To end, I installed the same project in a Mac Pro and i did without a problem. I hope someone can help me with this. Thanks for reading.

like image 804
Hikaru Avatar asked Oct 20 '25 13:10

Hikaru


2 Answers

As discussed here: https://github.com/adobe/aem-guides-wknd/pull/202

Adobe have reported the issue and the fix to Adobe AEM WKND project:

Some Windows users experience a Maven enforcer issue where it appears that default dispatcher files have been modified. Unclear if this is a result of differences between Mac and Windows or something that occurs during the checkout process. Most users simply want to install the code base to a local environment and this check is unnecessary. Removing the enforcement for windows builds.

so you can :

Skips Dispatcher enforcement plugin for users on windows environments.

doing a change you dispatcher/pom.xml with the commit reported here:

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

replacing the line:

<goal>enforce</goal>

with:

<goal>display-info</goal>
like image 89
Francesco Avatar answered Oct 23 '25 03:10

Francesco


[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

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. This xml snippet is from the maven plugin documentation.

<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.

like image 29
usuario Avatar answered Oct 23 '25 02:10

usuario



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!