Question

We're using wro4j with the Orange wr4j-taglib, and sometimes when we deploy its loading the same resource twice instead of two different ones, but not on all the servers. Below is the snippet from our groups in wro.xml. We're using the build time solution, so the hashes for the property file and all the concatenated files are being generated at build time.

<group name="insertImageCore">
    <js>/static/js/imageinsert/js/imageInsert.js</js>
    <js>/static/js/imageinsert/js/util/imageInsertUtils.js</js>
    <js>/static/js/imageinsert/js/util/imageDAO.js</js>
    <js>/static/js/imageinsert/js/util/serviceCalls.js</js>
    <js>/static/js/imageinsert/js/util/search.js</js>
    <js>/static/js/jquery.ux.thumbGrid.js</js>
    <js>/static/js/jquery.ux.stateManager.js</js>
    <css>/static/css/jquery.ux.thumbGrid.css</css>
    <css>/static/css/jquery.ux.stateManager.css</css>
</group>

<group name="insertImage">
    <group-ref>insertImageCore</group-ref>
    <js>/static/js/imageinsert/js/actionBar.js</js>
    <js>/static/js/imageinsert/js/imageEdit.js</js>
    <js>/static/js/imageinsert/js/imageEditPicnik.js</js>
    <js>/static/js/imageinsert/js/imageEditPicmonkey.js</js>
    <js>/static/js/imageinsert/js/imageEditAviary.js</js>
    <js>/static/js/imageinsert/js/imageEditNone.js</js>
    <js>/static/js/imageinsert/js/insertProps.js</js>
    <js>/static/js/imageinsert/js/tabsManager.js</js>
    <js>/static/js/imageinsert/js/uploadManager.js</js>
    <js>/static/js/imageinsert/js/zoomView.js</js>
    <js>/static/js/imageinsert/js/imageEdit.js</js>
    <js>/static/js/imageinsert/js/tabs/baseTab.js</js>
    <js>/static/js/imageinsert/js/tabs/imageUrl.js</js>
    <js>/static/js/imageinsert/js/tabs/myLibrary.js</js>
    <js>/static/js/imageinsert/js/tabs/picasaLibrary.js</js>
    <js>/static/js/imageinsert/js/tabs/stockGallery.js</js>
    <js>/static/js/imageinsert/js/tabs/templateImages.js</js>
    <js>/static/js/moment/moment.js</js>

    <css>/static/js/imageinsert/css/imageInsert.css</css>
</group>

In our jsps we're referencing the two groups as:

<wro:style groupNames='insertImage' exploded="${_explodeScripts}" />
<wro:style groupNames='insertImageCore' exploded="${_explodeScripts}" />

It ends up being included in the jsp as:

<link rel='stylesheet' href='/wro/insertImageCore-46098451.css' />
<link rel='stylesheet' href='/wro/insertImageCore-46098451.css' />

We've checked our JBoss /tmp directory on the bad machines, and it seems to be cleared out correctly during the deploy. Any ideas as to what is going on?

Était-ce utile?

La solution

It looks like your problem is the names your using. Try renaming either insertImage or insertImageCore so that they don't start with the same string. When the taglib can't find the mapping file that tells it what the combined css name is for that group it uses a fallback mechanism. The taglib gets all the files that exist in the wro root (which you must have configured o it can build proper paths) and compares their file names to the requested group. This comparision uses startsWith so when it finds a file named inserImageCore while looking for insertImage it thinks it's found the right one. This assumes that you either don't have a mapping file or that it isn't being loaded.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top