Uploaded image for project: 'XWiki Commons'
  1. XWiki Commons
  2. XCOMMONS-155

XAR Plugin doesn't always preserve old files in the resources when adding pages from dependencies



    • Bug
    • Resolution: Unresolved
    • Minor
    • None
    • 3.5
    • None


      it's caused by the fact that, when unarchiving, the org.codehaus.plexus.archiver.zip.ZipUnArchiver is checking, besides the fact that the file exists and the fact that it should not overwrite, the dates of the files (the one to overwrite and the one from the archive).

      if ( !isOverwrite() && f.exists() && ( f.lastModified() >= entryDate.getTime() ) )

      To reproduce, I did this kind of thing in a module with xar packaging:

      • in the dependencies

      and then in the plugins section:

                <!-- We add this execution here to have enterprise default Dashboard.WebHome in the resources so that the 
                     Dashboard.WebHome of the manager-ui is not overwriting this one, since the manager-ui one is workspaces 
                     specific and we don't want it.-->

      The intention of this is to force the Dashboard.WebHome that ends up in the final xar to be the one from the dashboard-ui instead of the one from manager-ui-all. The unxar would add it in the target/classes folder at generate-resources time, before the packaging phase, when the xar plugin would find it as 'existing' and would not overwrite it with the one from the xar dependency, as per the rule of the xar plugin. However this doesn't happen because of the extra dates check.
      Note that the xwiki-manager-ui-all.xar must be newer than the xwiki-platform-dashboard-ui.xar for the bug to reproduce (rebuild xwiki-manager-ui-all in case it doesn't happen or force a refetch or something).


        Issue Links



              Unassigned Unassigned
              lucaa Anca Luca
              1 Vote for this issue
              3 Start watching this issue