Maven WAR Plugin
  1. Maven WAR Plugin
  2. MWAR-54

add targetPath support on the webResources plugin parameter

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.2
    • Component/s: None
    • Labels:
      None

      Issue Links

        Activity

        Hide
        Marvin King added a comment -


        with test case

        Show
        Marvin King added a comment - with test case
        Hide
        Marvin King added a comment -


        see MWAR-48 for documentation

        Show
        Marvin King added a comment - see MWAR-48 for documentation
        Hide
        Brett Porter added a comment -

        there is a problem with this:
        a) doesn't apply straight up (due to imports on the test case). I fixed that.
        b) I commented out the targetPath line in AbstractWarMojo and the test still passed - so the test is faulty.

        Show
        Brett Porter added a comment - there is a problem with this: a) doesn't apply straight up (due to imports on the test case). I fixed that. b) I commented out the targetPath line in AbstractWarMojo and the test still passed - so the test is faulty.
        Hide
        Marvin King added a comment -
        • added some house keeping code on test cases
        • implemented the fixes based on the comment
        Show
        Marvin King added a comment - added some house keeping code on test cases implemented the fixes based on the comment
        Hide
        Maria Odea Ching added a comment -

        Patch applied Thanks

        Show
        Maria Odea Ching added a comment - Patch applied Thanks
        Hide
        Nick Johnson added a comment -

        This does not seem to be working in 2.0.6. The <targetPath> element is ignored and everything gets copied to the root of the webappDirectory.

        Show
        Nick Johnson added a comment - This does not seem to be working in 2.0.6. The <targetPath> element is ignored and everything gets copied to the root of the webappDirectory.
        Hide
        Jay Goldman added a comment -

        It does not appear to be working in 2.0.2. Based upon comments in War overlay can overwrite files in dependant war artifact I replaced the use of copyFileIfModified in copyResources with an unconditional copy (with an explicit creation of any needed directories first) and the files are copied to the correct location. So I think there is something wrong in copyFileIfModified when the target file does not exist (haven't checked the behavior when the target file already exists).

        Show
        Jay Goldman added a comment - It does not appear to be working in 2.0.2. Based upon comments in War overlay can overwrite files in dependant war artifact I replaced the use of copyFileIfModified in copyResources with an unconditional copy (with an explicit creation of any needed directories first) and the files are copied to the correct location. So I think there is something wrong in copyFileIfModified when the target file does not exist (haven't checked the behavior when the target file already exists).
        Hide
        Gordon Turner added a comment -

        Can confirm that <targetPath> does not appear to be working in 2.0.6.

        Should a new bug be logged or should this one be reopened?

        Show
        Gordon Turner added a comment - Can confirm that <targetPath> does not appear to be working in 2.0.6. Should a new bug be logged or should this one be reopened?
        Hide
        Jay Goldman added a comment -

        Actually, there are really 2 problems,

        • this one - which I think should be reopened.
        • And, I think there is also a problem with the way the 'src/main/resources' directory is handled.
          The on-line doc for the plugin says that 'src/main/resources' files will be copied to the target/classes and WEB-INF/classes but they are not, they are instaed copied to the WEB-INF directory. You can try to work around this by specifying the targetPath ... but, of course, that fails due to the underlying problem with targetPath (MWAR-54). Do you want me to open up another problem, i.e., that src/main/resource files are not copied where the doc says they are? This 'bug' could be 'fixed' by changing the doc

        WRT MWAR-54:
        The changes that marvin made to 'fix' the problem were definitely required - but they were not sufficient to correct the problem, at least when doing a clean build on a windows xp system.
        (note - there are additional fixes that should be made to the logging messages to accurately reflect what is going on - but i don't think there is anything incorrect about the code in the plugin inself)

        I think the underlying problem is the behavior of the copyFileIfModified method.
        I have not had the time to setup my machine to build maven (I was able to easily build a modified version of the plugin ... maven happily loaded up my machine will all the necessary pieces) - so I have not looked at this code.

        Show
        Jay Goldman added a comment - Actually, there are really 2 problems, this one - which I think should be reopened. And, I think there is also a problem with the way the 'src/main/resources' directory is handled. The on-line doc for the plugin says that 'src/main/resources' files will be copied to the target/classes and WEB-INF/classes but they are not, they are instaed copied to the WEB-INF directory. You can try to work around this by specifying the targetPath ... but, of course, that fails due to the underlying problem with targetPath ( MWAR-54 ). Do you want me to open up another problem, i.e., that src/main/resource files are not copied where the doc says they are? This 'bug' could be 'fixed' by changing the doc WRT MWAR-54 : The changes that marvin made to 'fix' the problem were definitely required - but they were not sufficient to correct the problem, at least when doing a clean build on a windows xp system. (note - there are additional fixes that should be made to the logging messages to accurately reflect what is going on - but i don't think there is anything incorrect about the code in the plugin inself) I think the underlying problem is the behavior of the copyFileIfModified method. I have not had the time to setup my machine to build maven (I was able to easily build a modified version of the plugin ... maven happily loaded up my machine will all the necessary pieces) - so I have not looked at this code.
        Hide
        Mark Lynde added a comment -

        Still not working in v 2.0.7.. The <targetPath> element is ignored and everything gets copied to the root of the webappDirectory. Can an admin please reopen this issue.

        Show
        Mark Lynde added a comment - Still not working in v 2.0.7.. The <targetPath> element is ignored and everything gets copied to the root of the webappDirectory. Can an admin please reopen this issue.
        Hide
        ricone added a comment -

        <targetPath> still not working in 2.0.8, please help. thanks a lot

        Show
        ricone added a comment - <targetPath> still not working in 2.0.8, please help. thanks a lot
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        Have you try with last SNAPSHOT ?
        If it fail with it can you provide a simple project to reproduce the issue ?
        Thanks.

        Show
        Olivier Lamy (*$^¨%`£) added a comment - Have you try with last SNAPSHOT ? If it fail with it can you provide a simple project to reproduce the issue ? Thanks.
        Hide
        Brian Weiner added a comment -

        Everyone is having the same problem I was having. The fix is in 2.0.2 of the plugin, not maven. So specify the version like so:

        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.0.2</version>

        and It'll work fine.

        Show
        Brian Weiner added a comment - Everyone is having the same problem I was having. The fix is in 2.0.2 of the plugin, not maven. So specify the version like so: <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.0.2</version> and It'll work fine.

          People

          • Assignee:
            Marvin King
            Reporter:
            Marvin King
          • Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

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

                Development