Java – is there any way to force Maven to copy changes to the resource folder?

I use Maven 2.2 1 and M2 eclipse

I have two resource folders

When I save changes to any file in any resource folder, Maven incremental version will start and recopy all files in both resource folders to the destination folder

This behavior is good if the number of files in the resource folder is relatively small, but copying may take several minutes

Is there any way to force Maven to be more selective in incremental versions, copying only those changed resources?

Solution

I traced the problem back to org codehaus. plexus. util. FileUtils. Copyfile() method The method called by Maven resource plugin is to copy resources finally; The copyfile() method requires an 'overwrite' parameter, which is passed by the resource plug-in (the default value is false), but... If the passed filter wrapper list is not empty, the copyfile() method will ignore the "overwrite" parameter If the filtering of your resource is set to true, the list is indeed not empty I can understand the reason behind copyfile() ignoring "overwrite": just because the target file is relatively new does not mean that the new filter file will be the same (that is, the value of the variable in the resource file may have changed because of the last filter) Ignoring the override flag is "convenient" for FileUtils implementers But this is a big price; Unnecessarily updated individual resource files can trigger time-consuming but redundant processes (i.e., rebuilding jars with dependencies in my case) This may only take a few seconds, but it is enough to disrupt the flow of intensive code compilation and test cycles I found an open bug on FileUtils, but I didn't find any This is cheating me, so I have to chase it, but I can't spend more time now... In a few days, I want to submit an error report (maybe achieve the correct solution faster); I would appreciate it if someone could post a link to the corresponding error tracking / reporting system

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>