Uploaded image for project: 'Maven WAR Plugin'
  1. Maven WAR Plugin
  2. MWAR-47

Regression : Files not copied when overlaying wars

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0
    • 2.0.1
    • None
    • None

    Description

      The handy "overlay wars" functionnality seems to have changed with release 2.0 : files that are already in place (no matter last modification date) are never overwritten from overlaid wars.
      This is problematic since after a first packaging of the war file, any file coming from a dependent war will already sit there and will never be updated.

      The faulty line is here (AbstractWarMojo.java):
      for ( int j = 0; j < files.length; j++ )
      {
      File targetFile = new File( targetDir, files[j] );

      // Do not overwrite existing files.
      if ( !targetFile.exists() ) // <========================== WILL ALWAYS FAIL
      {
      try

      { targetFile.getParentFile().mkdirs(); copyFileIfModified( new File( srcDir, files[j] ), targetFile ); }

      catch ( IOException e )

      { throw new MojoExecutionException( "Error copying file '" + files[j] + "' to '" + targetFile + "'", e ); }

      }
      }

      My use case is, I guess, pretty common : I have a "framework" project (packaging = war) that must benefit may "real, final" projects that produce the final artifact (packaging = war as well). The "framework" part is a 'dependent war' of the real project and is 'overlaid' by the war plugin. The trouble is, if I update any file of the framework part, changes are not taken into account since files already exist in the target directory.

      Please consider removing the " if ( !targetFile.exists() )" part (last modification date alone is fine).

      regards,
      eb.

      Attachments

        Issue Links

          Activity

            People

              brett Brett Porter
              vvinnie vvinnie
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0.5h Original Estimate - 0.5h
                  0.5h
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.75h
                  0.75h