Monday, July 30, 2018

Problem Solved: Failed to execute goal

While running Maven to build our AEM project at work I kept getting "[ERROR] Failed to execute goal (install-package-author) on project myproj_apps: Error while installing package. Check log for details. [Help 1]"

I further tracked it down to this 504 error:

[INFO] Installing myproj_apps (C:\Git\myproj\apps\target\myproj_apps- to http://localhost:4502/crx/packmgr/service.jsp
[ERROR] Request to http://localhost:4502/crx/packmgr/service.jsp failed, response=Gateway Timeout

But why would the install timeout on my own box?  If I put "http://localhost:4502/crx/packmgr/service.jsp" into my browser, it replied instantly with a banner message.

I suspected the proxy settings, and sure enough if I add "<useProxy>false</useProxy>" to my execution configuration in the POM it worked!

But where was it trying to use the proxy?  Not in my ~/.m2/settings.xml file.

The culprit turned out to be in my maven install directory's settings.xml file, c:/Program Files/Apache/maven/apache-maven-3.5.3/conf/settings.xml. It had two proxies defined.  The default for "useProxy" is "true", so while trying to install on my local box, maven was trying to use a proxy, which was failing.

Solution:  add "<useProxy>false</useProxy>" to your POM file, or remove the proxy from the maven install directory.