You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ji...@codehaus.org on 2004/06/24 17:47:31 UTC

[jira] Created: (MJT-1) copyResources does not preservelastmodified

Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/MJT-1

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MJT-1
    Summary: copyResources does not preservelastmodified
       Type: Bug

     Status: Unassigned
   Priority: Minor

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: maven-jelly-tags
   Versions:
             1.0

   Assignee: 
   Reporter: Matthias Kerkhoff

    Created: Thu, 24 Jun 2004 11:45 AM
    Updated: Thu, 24 Jun 2004 11:45 AM
Environment: maven-1.0rc3

Description:
I noticed that whenever files are copied with the help of maven:copyResources the lastModified time is updated.

This happens because the underlying ant copyTask is not
called with preserveLastModified=true.
(org.apache.maven.jelly.tags.maven.CopyResources, lines 109-137)

While this is only annoying for me, I can easily imagine situations in which this behaviour will cause real problems.
For example, commercial software often checks the last
modified timestamp of some files. 
Actually, I digged into this because I tried to understand why some ears and rars in our project are constantly rebuild - even if we didn't change anything between the builds. So, fixing this (or adding an additional parameter to the tag) may also result in a performance gain. 



---------------------------------------------------------------------
JIRA INFORMATION:
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

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Commented: (MAVEN-1623) copyResources does not preservelastmodified

Posted by "Laird Nelson (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MAVEN-1623?page=comments#action_54000 ] 

Laird Nelson commented on MAVEN-1623:
-------------------------------------

For those who care, here is a port of the copyResources tag in jelly with the added setPreserveLastModified() call thrown in there.  Stand back.  You'll need to set a jelly variable named "todir" to the destination directory name.

    <j:forEach var="resource" items="${pom.build.resources}">
      <j:set var="directoryName" value="${resource.directory}"/>
      <j:new var="directory" className="java.io.File">
        <j:arg value="${directoryName}"/>
      </j:new>
      <j:choose>
        <j:when test="${directory.exists() and directory.isDirectory() and directory.canRead()}">
          <j:new var="targetDirectoryBuffer" className="java.lang.StringBuffer">
            <j:arg value="${todir}"/>
          </j:new>
          <j:set var="targetPath" value="${resource.targetPath}"/>
          <j:if test="${targetPath != null and targetPath.trim().length() != 0}">
            <j:mute>
              <j:expr value="${targetDirectoryBuffer.append('/').append(targetPath)}"/>
            </j:mute>
          </j:if>
          <j:new var="targetDirectory" className="java.io.File">
            <j:arg value="${targetDirectoryBuffer.toString()}"/>
          </j:new>
          <j:new var="copyTask" className="org.apache.tools.ant.taskdefs.Copy"/>
          <j:expr value="${copyTask.setProject(context.getAntProject())}"/>
          <j:expr value="${copyTask.setTodir(targetDirectory)}"/>
          <j:expr value="${copyTask.setFiltering(resource.isFiltering())}"/>
          <j:expr value="${copyTask.setOverwrite(resource.isFiltering())}"/>
          <j:expr value="${copyTask.setPreserveLastModified(true)}"/>
          <j:new var="fileSet" className="org.apache.tools.ant.types.FileSet"/>
          <j:expr value="${fileSet.setDir(directory)}"/>
          <j:if test="${resource.includes.isEmpty()}">
            <j:set var="entry" value="${fileSet.createInclude()}"/>
            <j:set var="starStarSlashStarStar" value="**/**"/>
            <j:expr value="${entry.setName(starStarSlashStarStar)}"/>
          </j:if>
          <j:forEach var="includeString" items="${resource.includes}">
            <j:set var="entry" value="${fileSet.createInclude()}"/>
            <j:expr value="${entry.setName(includeString)}"/>
          </j:forEach>
          <j:forEach var="excludeString" items="${resource.excludes}">
            <j:set var="entry" value="${fileSet.createExclude()}"/>
            <j:expr value="${entry.setName(excludeString)}"/>
          </j:forEach>
          <j:expr value="${copyTask.addFileset(fileSet)}"/>
          <j:expr value="${copyTask.execute()}"/>
        </j:when>
        <j:otherwise>
          <ant:echo message="${targetDirectory} is either not a directory, not readable, or nonexistent."/>
        </j:otherwise>
      </j:choose>
    </j:forEach>

Cheers,
Laird (ljnelson@gmail.com)

> copyResources does not preservelastmodified
> -------------------------------------------
>
>          Key: MAVEN-1623
>          URL: http://jira.codehaus.org/browse/MAVEN-1623
>      Project: Maven
>         Type: Bug

>  Environment: maven-1.0rc3
>     Reporter: Matthias Kerkhoff
>     Priority: Minor
>      Fix For: 1.1-beta-3

>
>
> I noticed that whenever files are copied with the help of maven:copyResources the lastModified time is updated.
> This happens because the underlying ant copyTask is not
> called with preserveLastModified=true.
> (org.apache.maven.jelly.tags.maven.CopyResources, lines 109-137)
> While this is only annoying for me, I can easily imagine situations in which this behaviour will cause real problems.
> For example, commercial software often checks the last
> modified timestamp of some files. 
> Actually, I digged into this because I tried to understand why some ears and rars in our project are constantly rebuild - even if we didn't change anything between the builds. So, fixing this (or adding an additional parameter to the tag) may also result in a performance gain.

-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Closed: (MAVEN-1623) copyResources does not preservelastmodified

Posted by "Lukas Theussl (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MAVEN-1623?page=all ]
     
Lukas Theussl closed MAVEN-1623:
--------------------------------

    Resolution: Fixed

> copyResources does not preservelastmodified
> -------------------------------------------
>
>          Key: MAVEN-1623
>          URL: http://jira.codehaus.org/browse/MAVEN-1623
>      Project: Maven
>         Type: Bug

>  Environment: maven-1.0rc3
>     Reporter: Matthias Kerkhoff
>     Priority: Minor
>      Fix For: 1.1-beta-3

>
>
> I noticed that whenever files are copied with the help of maven:copyResources the lastModified time is updated.
> This happens because the underlying ant copyTask is not
> called with preserveLastModified=true.
> (org.apache.maven.jelly.tags.maven.CopyResources, lines 109-137)
> While this is only annoying for me, I can easily imagine situations in which this behaviour will cause real problems.
> For example, commercial software often checks the last
> modified timestamp of some files. 
> Actually, I digged into this because I tried to understand why some ears and rars in our project are constantly rebuild - even if we didn't change anything between the builds. So, fixing this (or adding an additional parameter to the tag) may also result in a performance gain.

-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org