CQ5.6, Jquery version up gradation from 1.11.2 to 2.x.x causing problem | Community
Skip to main content
New Participant
Dec 6, 2017 8:40 AM UTC
Solved

CQ5.6, Jquery version up gradation from 1.11.2 to 2.x.x causing problem

Hi

I am trying to upgrade jquery version from 1.11 to 2.0.0. After updating the version in js.txt file, jquery file is not getting minified. I am getting below error :-

com.day.cq.widget.impl.HtmlLibraryManagerImpl Error during assembly of library. org.mozilla.javascript.EvaluatorException: Compilation produced 30 syntax errors.

  at com.day.cq.widget.impl.JsFileBuilder$1.runtimeError(JsFileBuilder.java:102)

  at org.mozilla.javascript.Parser.parse(Parser.java:392)

  at org.mozilla.javascript.Parser.parse(Parser.java:337)

  at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312)

  at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533)

  at com.day.cq.widget.impl.JsFileBuilder.minify(JsFileBuilder.java:78)

  at com.day.cq.widget.impl.AbstractBuilder.build(AbstractBuilder.java:37)

  at com.day.cq.widget.impl.HtmlLibraryManagerImpl.update(HtmlLibraryManagerImpl.java:1652)

  at com.day.cq.widget.impl.HtmlLibraryManagerImpl.getCacheNode(HtmlLibraryManagerImpl.java:1594)

  at com.day.cq.widget.impl.HtmlLibraryManagerImpl.getLastModified(HtmlLibraryManagerImpl.java:1423)

  at com.day.cq.widget.impl.HtmlLibraryImpl.getLastModified(HtmlLibraryImpl.java:150)

  at com.day.cq.widget.impl.HtmlLibraryManagerImpl.send(HtmlLibraryManagerImpl.java:1445)

  at com.day.cq.widget.impl.HtmlLibraryImpl.send(HtmlLibraryImpl.java:166)

  at com.day.cq.widget.impl.HtmlLibraryServlet.doGet(HtmlLibraryServlet.java:92)

  at org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:268)

  at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:344)

Thanks

Rahul

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
VeenaVikraman
VeenaVikramanAccepted solution
New Participant
Dec 8, 2017 5:10 PM UTC

Hi Rahul,

  AEM version till 6.1 uses YUI compressor by default. This particular compressor is not so perfect and throws error many time when you try to add any plugin which is not compilable and minified using this compressor. Especially most of the latest JS frameworks wont be compatible with this compressor. Said that, I could find that Jquery 2+ versions are not compatible with this compressor YUI Compressor 2.4.8 failed on jQuery 2.2 · Issue #234 · yui/yuicompressor · GitHub

    Unfortunately, there is not solution for this. Only one thing which you can do at this point if you really want to upgrade Jquery is to disbale minification in publish and directly use a minified version of your JS.

You can disable minification as mentioned below

Client Library Configuration: Minify and Debug | AEM Tips

PS:- AEM 6.2 onwards you can use Google Closure Compiler (GCC) which is more advanced and supports almost all latest JS. Read more here How to Use The Google Closure Compiler with AEM 6.2+ | Adobe

Thanks

Veena

8 replies

therahulAuthor
New Participant
Dec 11, 2017 9:07 AM UTC

Thank you Veena.

Translate
VeenaVikraman
New Participant
Dec 8, 2017 6:44 PM UTC

No abhishek. I no longer use 5.6 . For last 1 n half years we are using 6.1 and now 6.2 . So I am not sure what version of YUI compressor is present in 5.6 .

Translate
Employee
Dec 8, 2017 6:01 PM UTC

I tried compressing minified version of jquery 2.2.4 (https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js ) with online YUI compressor and it was successful:

YUI Compressor Online

Translate
Employee
Dec 8, 2017 5:47 PM UTC

Very well explained by Veena_07​

Did you try using/including already minified version of jquery 2.x.x?

Translate
VeenaVikraman
VeenaVikramanAccepted solution
New Participant
Dec 8, 2017 5:10 PM UTC

Hi Rahul,

  AEM version till 6.1 uses YUI compressor by default. This particular compressor is not so perfect and throws error many time when you try to add any plugin which is not compilable and minified using this compressor. Especially most of the latest JS frameworks wont be compatible with this compressor. Said that, I could find that Jquery 2+ versions are not compatible with this compressor YUI Compressor 2.4.8 failed on jQuery 2.2 · Issue #234 · yui/yuicompressor · GitHub

    Unfortunately, there is not solution for this. Only one thing which you can do at this point if you really want to upgrade Jquery is to disbale minification in publish and directly use a minified version of your JS.

You can disable minification as mentioned below

Client Library Configuration: Minify and Debug | AEM Tips

PS:- AEM 6.2 onwards you can use Google Closure Compiler (GCC) which is more advanced and supports almost all latest JS. Read more here How to Use The Google Closure Compiler with AEM 6.2+ | Adobe

Thanks

Veena

Translate
smacdonald2008
Level 10
Dec 8, 2017 3:52 PM UTC

If you create a clientlibs and use the property dependencies and set the values as a string[] and cq.jquery - you can make use of the version that AEM is using. THen load a page and you can inspect the page using Chrome.

javascript - Get jQuery version from inspecting the jQuery object - Stack Overflow 

Hope this helps...

Translate
therahulAuthor
New Participant
Dec 8, 2017 9:01 AM UTC

Hi,

Thanks for the quick response.

Could you please let me know the supported Jquery version for CQ5.6?

Or please suggest any link where i can get this.

Thanks

Rahul

Translate
smacdonald2008
Level 10
Dec 6, 2017 4:27 PM UTC

Its recommended to use AEM Version of JQuery.

Translate