jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Signup
Maven 1.x War Plugin
  • Maven 1.x War Plugin
  • MPWAR-68

corrupt images after copy

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.6.2
  • Fix Version/s: 1.6.3
  • Labels:
    None
  • Number of attachments :
    3

Description

maven-1.1-beta-3 seems to corrupt images during a <copy>.

I'll attach two samples:

  • corrupt-copy (2284 bytes)
  • original (843 bytes)
  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. descending.gif
    2 kB
    07/Nov/06 7:27 AM
  2. descending.gif
    0.8 kB
    07/Nov/06 7:26 AM
  3. descending.gif
    2 kB
    07/Nov/06 7:26 AM

Issue Links

relates to

Bug - A problem which impairs or prevents the functions of the product. MPWAR-46 The war:war-resources goal should use filter when copying the resources

  • Major - Major loss of function.
  • Resolved - A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.

Bug - A problem which impairs or prevents the functions of the product. MPWAR-65 Problems with maven.war.property.expansion

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Lukas Theussl added a comment - 07/Nov/06 7:31 AM

What do you mean with 'during a copy'. What are you trying to do excactly?

Show
Lukas Theussl added a comment - 07/Nov/06 7:31 AM What do you mean with 'during a copy'. What are you trying to do excactly?
Hide
Permalink
G.J. Sterenborg added a comment - 07/Nov/06 7:51 AM

I apologize for the short description.

What I meant was a copy-operation in war-goals, ear-goals and jar goals.

When executing, for example, a 'maven war', and files are copied to the target directory before packaging the result is similar to the attached files.

Show
G.J. Sterenborg added a comment - 07/Nov/06 7:51 AM I apologize for the short description. What I meant was a copy-operation in war-goals, ear-goals and jar goals. When executing, for example, a 'maven war', and files are copied to the target directory before packaging the result is similar to the attached files.
Hide
Permalink
Arnaud Heritier added a comment - 07/Nov/06 8:16 AM

This problem is often due to the usage of a filter during the copy of binaries.
We'll try to see if there is a bad setting in a copy task.

Show
Arnaud Heritier added a comment - 07/Nov/06 8:16 AM This problem is often due to the usage of a filter during the copy of binaries. We'll try to see if there is a bad setting in a copy task.
Hide
Permalink
G.J. Sterenborg added a comment - 08/Nov/06 1:49 AM

If that is the case, is there some way to work around this?

Show
G.J. Sterenborg added a comment - 08/Nov/06 1:49 AM If that is the case, is there some way to work around this?
Hide
Permalink
Arnaud Heritier added a comment - 08/Nov/06 3:18 AM

It seems to be a bug.
I don't know when it was introduced.
In the plugin code, for the goal war:war-resources, we have :

    <j:if test="${webSourcesPresent == 'true'}">
      <ant:copy todir="${maven.war.webapp.dir}" filtering="on"
                preservelastmodified="true"
                overwrite="${maven.war.resources.overwrite}">
        <ant:fileset dir="${maven.war.src}"
          includes="${maven.war.src.includes}"
          excludes="${maven.war.src.excludes}">
        </ant:fileset>
        <j:if test="${maven.war.property.expansion}" >
          <ant:filterchain>
            <ant:expandproperties/>
          </ant:filterchain>
        </j:if>
      </ant:copy>
    </j:if>

The filtering is activated but if you exclude your images using maven.war.src.excludes, these ones will not be copied.
Temporarly, what you can do it's to define your binary resources in maven.war.src.exclude.
For example : maven.war.src.exclude=*/.gif,*/.jpg
Then you add a post goal of war:war-resources in you project to copy your binary resources without filter :

<postGoal name="war:war-resources">
    <j:if test="${webSourcesPresent == 'true'}">
      <ant:copy todir="${maven.war.webapp.dir}" filtering="off"
                preservelastmodified="true"
                overwrite="${maven.war.resources.overwrite}">
        <ant:fileset dir="${maven.war.src}"
          includes="${maven.war.src.excludes}"
          excludes="${maven.war.src.includes}">
        </ant:fileset>
        <j:if test="${maven.war.property.expansion}" >
          <ant:filterchain>
            <ant:expandproperties/>
          </ant:filterchain>
        </j:if>
      </ant:copy>
    </j:if>  
</postGoal>

(You noticed that I reversed excludes and includes)
With that it should works.
For us, what we have to do is either to remove the filtering (I don't know if it useful) or to keep it but to add a property maven.war.bin.excludes which will be used to don't copy this resources with a filter.

Show
Arnaud Heritier added a comment - 08/Nov/06 3:18 AM It seems to be a bug. I don't know when it was introduced. In the plugin code, for the goal war:war-resources, we have : <j:if test= "${webSourcesPresent == 'true'}" > <ant:copy todir= "${maven.war.webapp.dir}" filtering= "on" preservelastmodified= "true" overwrite= "${maven.war.resources.overwrite}" > <ant:fileset dir= "${maven.war.src}" includes= "${maven.war.src.includes}" excludes= "${maven.war.src.excludes}" > </ant:fileset> <j:if test= "${maven.war.property.expansion}" > <ant:filterchain> <ant:expandproperties/> </ant:filterchain> </j:if> </ant:copy> </j:if> The filtering is activated but if you exclude your images using maven.war.src.excludes, these ones will not be copied. Temporarly, what you can do it's to define your binary resources in maven.war.src.exclude. For example : maven.war.src.exclude=* / .gif,* / .jpg Then you add a post goal of war:war-resources in you project to copy your binary resources without filter : <postGoal name= "war:war-resources" > <j:if test= "${webSourcesPresent == 'true'}" > <ant:copy todir= "${maven.war.webapp.dir}" filtering= "off" preservelastmodified= "true" overwrite= "${maven.war.resources.overwrite}" > <ant:fileset dir= "${maven.war.src}" includes= "${maven.war.src.excludes}" excludes= "${maven.war.src.includes}" > </ant:fileset> <j:if test= "${maven.war.property.expansion}" > <ant:filterchain> <ant:expandproperties/> </ant:filterchain> </j:if> </ant:copy> </j:if> </postGoal> (You noticed that I reversed excludes and includes) With that it should works. For us, what we have to do is either to remove the filtering (I don't know if it useful) or to keep it but to add a property maven.war.bin.excludes which will be used to don't copy this resources with a filter.
Hide
Permalink
Lukas Theussl added a comment - 08/Nov/06 3:52 AM

The filtering in the war plugin was introduced in MPWAR-46. However, the ear and jar plugins don't use the ant:copy task but rather the maven:copyResources tag of the maven jelly tag library. This sems to be an inconsistency unless I'm missing something. You said you also had problems with the ear and jar goals? In this case we'd have to fix this consistently for all plugins, otherwise, I'd say we just revert MPWAR-46.

Show
Lukas Theussl added a comment - 08/Nov/06 3:52 AM The filtering in the war plugin was introduced in MPWAR-46 . However, the ear and jar plugins don't use the ant:copy task but rather the maven:copyResources tag of the maven jelly tag library. This sems to be an inconsistency unless I'm missing something. You said you also had problems with the ear and jar goals? In this case we'd have to fix this consistently for all plugins, otherwise, I'd say we just revert MPWAR-46 .
Hide
Permalink
G.J. Sterenborg added a comment - 08/Nov/06 10:21 AM

Our maven.xml contained:

 
<preGoal name="war:init">
   <ant:tstamp>
     <format property="TODAY_LONG" pattern="dd-MM-yyyy" locale="en"/>
   </ant:tstamp>
   <ant:filter token="DATE_FORMAT" value="dd-MM-yyyy" />
   <ant:filter token="BUILD_DATE" value="${TODAY_LONG}" />
</preGoal>

Removing this preGoal fixed the problem.

Wouldn't it be better to be able to enable/disable filtering via a property?

Show
G.J. Sterenborg added a comment - 08/Nov/06 10:21 AM Our maven.xml contained: <preGoal name="war:init"> <ant:tstamp> <format property="TODAY_LONG" pattern="dd-MM-yyyy" locale="en"/> </ant:tstamp> <ant:filter token="DATE_FORMAT" value="dd-MM-yyyy" /> <ant:filter token="BUILD_DATE" value="${TODAY_LONG}" /> </preGoal> Removing this preGoal fixed the problem. Wouldn't it be better to be able to enable/disable filtering via a property?
Hide
Permalink
Stéphane Nicoll added a comment - 01/May/07 3:41 AM

filter="on" is not the only problem. If you activate property expansion, you're stuck if you have binary files to copy.

We can customize the filter property, not sure that this will solve the problem at all. (Still thinking)

Show
Stéphane Nicoll added a comment - 01/May/07 3:41 AM filter="on" is not the only problem. If you activate property expansion, you're stuck if you have binary files to copy. We can customize the filter property, not sure that this will solve the problem at all. (Still thinking)
Hide
Permalink
Stéphane Nicoll added a comment - 01/May/07 10:45 AM

Added maven.war.expansion.excludes property to exclude files during a property expansion copy (Fixes corruption of binary files). Applied property expansion to web.xml handling for consistency. Introduced the maven.war.src.filtering property to control whether filtering is enabled or not when copying webapp resources.

Show
Stéphane Nicoll added a comment - 01/May/07 10:45 AM Added maven.war.expansion.excludes property to exclude files during a property expansion copy (Fixes corruption of binary files). Applied property expansion to web.xml handling for consistency. Introduced the maven.war.src.filtering property to control whether filtering is enabled or not when copying webapp resources.

People

  • Assignee:
    Stéphane Nicoll
    Reporter:
    G.J. Sterenborg
Vote (0)
Watch (1)

Dates

  • Created:
    07/Nov/06 7:26 AM
    Updated:
    01/May/07 10:45 AM
    Resolved:
    01/May/07 10:45 AM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.