Expand my Community achievements bar.

Maven Build Error when including dispatcher module

Avatar

Community Advisor

Hi All,

 

I am getting the below maven build error when including the dispatcher module in my project pom for local build.

 

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce (enforce-checksum-of-immutable-files) on project xyz.dispatcher.cloud: Unable to parse configuration of mojo org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce for parameter requireTextFileChecksum: Cannot create instance of interface org.apache.maven.enforcer.rule.api.EnforcerRule: org.apache.maven.enforcer.rule.api.EnforcerRule.<init>() -> [Help 1]

 

I was able to get a workaround for the local build by making the below change in dispatcher module's pom.xml

<goal>enforce</goal> CHANGED TO <goal>display-info</goal>

However, I will need to have the goal set to enforce when deploying this to other environments.

The default files for vhosts, rewrites, farms etc have not been modified in any ways.

 

The pom.xml for dispatcher for the specific goal is stated below -

Maven_Dispatcher_POM.png

8 Replies

Avatar

Community Advisor

Try to add 

<goals>
<goal>single</goal>
</goals>

 

Thanks

Himanshu Jain

Avatar

Community Advisor

Hi Himanshu,

 

The build still failed with the below error - 

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 07:01 min
[INFO] Finished at: 2022-06-24T16:44:24+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Could not find goal 'single' in plugin org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3 among available goals display-info, enforce, help -> [Help 1]

 

There are apparently only 2 goals for the enforcer plugin.

Avatar

Community Advisor

Hi @Rohan_Garg ,

Are you using Windows? According to this thread: https://github.com/adobe/aem-guides-wknd/pull/202 It was the discussion about fixing issue on Windows. Apparently, when you want to build this on different environment(I believe those are Unix/Linux based) - in that case <goal>enforce</goal>  should work, since PR skips enforce for windows users.

This error is caused, as the dispatcher owner does not not want you to change/modify few of its default files which are marked as immutable in dispatcher server. 
You can find full list of immutable files on of dispatcher provided by Adobe. 

 

Solution: To make sure you do not modify the default files the maven dispatcher module forces the file checksum verification method. 

 

Worth visiting this article: https://www.aemrules.com/2021/06/deployment-pipe-line-is-failing-due-to.html


Regards,

Santosh

Avatar

Community Advisor

Hi Santosh,

 

Thanks for the reply.

Yes, I am using windows machine and have been referring to the same articles.

We tried to deploy the same pom/xml on a mac machine which is Unix based but got the same error.

 

On a side note, if we replaced the default files again and overlay them with our custom configuration then the enforcer issue should not be there on windows machine too right ?

Currently we haven't changed any of the default configurations but still the error is coming on both mac and windows machine. The display-info goal works but might not be feasible on a production deployment. 

 

Thanks,

Rohan Garg

 

 

 

 

 

Avatar

Level 1

Hi Rohan,

I am facing the same issue as mentioned in this thread.

Were you able to find any resolution for it?

Thanks,
Gautam

Avatar

Community Advisor

Hi @grauthan12 ,

 

I hope this is not a blocker for you as there is a workaround for it -

<goal>enforce</goal> CHANGED TO <goal>display-info</goal>

 

The forced checksum are anyways validated by the DISPATCHER_BUILD_CONFIGURATION in the Deployment.

Hope this helps!

Avatar

Level 1

Hi Rohan,

 

Will this workaround not give build issues when deploying to the cloud?

Avatar

Community Advisor

No, the cloud's dispatcher deployment overrides the default files anyways.

If you read the comment in these files it will say that your changes will have no impact.

Changing goal just ensures that the build does not fail on file changes.