Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

Avatar

Level 1

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

0 Replies

Avatar

Level 10

Its recommended to use AEM Version of JQuery.

Avatar

Level 1

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

Avatar

Level 10

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

Avatar

Correct answer by
Community Advisor

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

Avatar

Employee

Very well explained by Veena_07

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

Avatar

Employee

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

Avatar

Community Advisor

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 .