[
http://jira.codehaus.org/browse/MRESOURCES-120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dennis Lundberg updated MRESOURCES-120:
---------------------------------------
Component/s: copy
> Resource file is never overwritten
> ----------------------------------
>
> Key: MRESOURCES-120
> URL: http://jira.codehaus.org/browse/MRESOURCES-120
> Project: Maven 2.x Resources Plugin
> Issue Type: Bug
> Components: copy
> Affects Versions: 2.3
> Environment: Windows XP Professional SP3
> Maven 2.2.1
> jdk1.6.0_18
> Reporter: Mark Dolgov
> Priority: Minor
>
> I have the 2 resource files with the same name (config.properties) under
> following locations:
> Location 1: .../src/main/resources/config.properties (modification date
> 2009-11-25)
> Location 2: .../src/main/resources/envSpecific/test/config.properties
> (modification date 2009-12-21)
> During build, config.properties should be put under target/classes folder.
> My pom configuration (see excerpt below) makes it so that:
> 1. 'config.properties' file from location 1 is copied to target/classes;
> 2. 'config.properties' file from location 2 is copied to target/classes and
> overwrites the one from previous step.
> Maven really tries to do that, see maven output excerpt below.
> The PROBLEM: the file, copied in step 2, does NOT overwrite the one, copied
> in step 1.
> Though, it works, when I set plugin property 'overwrite' == true. But since
> files modification dates are different (see above), it should work with
> overwrite==false.
> Possible cause:
> I debugged the related code a bit, and found, that maven-resources-plugin
> uses plexus-utils-1.5.6.jar, and its FileUtils.class for copying.
> In FileUtils, starting line 2049 there is a following code block:
> ------------
> if ( to.lastModified() < from.lastModified() || overwrite )
> {
> copyFile( from, to );
> }
> ------------
> According debug,
> - variable 'to' references the file, which has been already copied to
> target/class folder (on step 1).
> - variable 'from' references the file from the source (location 2).
> In my environment to.lastModified()< from.lastModified() == false, because
> file referenced by 'to' has modification date, when it was copied to class
> folder.
> Possible solution:
> I guess, 'from' file should be compared not to the one in target/class
> folder, but to corresponding file from source (location 1), which was copied
> to class folder (step 1).
> ----------------------------------------
> Maven build configuration, related to resources:
> <resources>
> <resource>
> <directory>src/main/resources</directory>
> <filtering>true</filtering>
> <excludes>
> <exclude>envSpecific/**/*</exclude>
> </excludes>
> </resource>
> <resource>
>
> <directory>${basedir}/src/main/resources/envSpecific/${env}</directory>
> <filtering>true</filtering>
> <includes>
> <include>**/*</include>
> </includes>
> </resource>
> </resources>
> Maven output (sorry, can't paste debug mode due security reasons, but it does
> not report any problems with copying):
> >mvn -Denv=test process-resources
> [INFO] Scanning for projects...
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building Election Results web module
> [INFO] task-segment: [process-resources]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] [resources:resources {execution: default-resources}]
> [INFO] Using 'UTF-8' encoding to copy filtered resources.
> [INFO] Copying 6 resources
> [INFO] Copying 1 resource
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESSFUL
> [INFO]
> ------------------------------------------------------------------------
> -----------------------------------
> Another minor problem, is that even though (in debug mode) maven declares
> '[INFO] Copying 1 resource', but it never says, if succeeded or not.
> Sorry, if not a bug or duplicate.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira