If filtering is enabled in Maven, then it will filter binary files too: and it 
is the case with Maven that your images are nearly guaranteed to be 
corrupted.

The ideal way to solve it is to separate files that need filtering from those 
that don't, by defining several resource directories:

http://maven.apache.org/plugins/maven-resources-plugin/examples/resource-directory.html

You may at first think that this would only collide if the image so happened 
to contain a replacement that exactly matched some available property -- like 
${version} by coincidence -- however, Maven has the tendency to touch 
seemingly everything in a filtered directory, in a way that causes it to 
differ after the resource phase executes. I don't know exactly what it uses 
for an algorithm there, but my rule of thumb is to 100% strictly separate 
things that do and don't want filtering. (It's likely that Maven simply 
copies, and re-writes every file, using the resources plugin's declared 
encoding; thereby munging any binary file that did not stay intact after 
reading and re-writing in that encoding.)

You are guaranteed to have a problem if you put a binary file into a filtered 
resource directory.

And filtering would be inherited if it were turned on in the parent POM.

On Tue July 24 2007 9:05:12 pm you wrote:
> I figured out that it has something to do with maven corrupting the
> image files in the resource directory. I'm trying to pin down the
> exact problem before blaming maven. However, just by pulling out a
> parent POM ref in my projects POM everything started to work.
>
> On 7/24/07, 小司 <[EMAIL PROTECTED]> wrote:
> > You can read this link
> > http://tapestry.apache.org/tapestry5/tapestry-core/guide/assets.html
> > or this link (in chinese)
> > http://www.javaeye.com/article/78348
> >
> > Maybe you can get some idea
> >
> > 2007/7/24, Todd Orr <[EMAIL PROTECTED]>:
> > > Ugh. I created a small test project and it works correctly there.
> > > Unfortunately, my real project is much larger. So, now I have the
> > > incredibly tedious task of starting a new project and adding code bit
> > > by bit until it breaks so that I can attempt to determine what is
> > > causing the failure.
> > >
> > > On 7/24/07, Nick Westgate <[EMAIL PROTECTED]> wrote:
> > > > Hi Todd.
> > > >
> > > > I just tested this, not with a template, but just writing HTML.
> > > > Details of my successful test follow, but first ...
> > > >
> > > > Are your images under the "resources" tree:
> > > > \myapp\src\main\resources\jp\co\key_planning\myapp\tapestry\component
> > > >s
> > > >
> > > > That's important, I think.
> > > >
> > > > My component CheckBoxImage.java
> > > >
> > > > ...
> > > > @Inject
> > > > @Path("check_checked.gif")
> > > > private Asset checkedImage;
> > > > ...
> > > > boolean beginRender(MarkupWriter writer)
> > > > {
> > > >      writer.element("img", "src", _test ? checkedImage :
> > > > uncheckedImage); ...
> > > >
> > > > Turns out fine in the HTML:
> > > > <img
> > > > src="/myapp/assets/jp/co/key_planning/myapp/tapestry/components/check
> > > >_checked.gif">
> > > >
> > > > And I can view the image in the browser at:
> > > > http://localhost:8080/myapp/assets/jp/co/key_planning/myapp/tapestry/
> > > >components/check_checked.gif
> > > >
> > > > Cheers,
> > > > Nick.
> > > >
> > > > Todd Orr wrote:
> > > > >> From what I see in the GridColumns code, I've coded this
> > > > >> correctly.
> > > > >
> > > > > I'm still confused about why this works for a core component but
> > > > > not a custom component. Unless anyone has any insight I'll create a
> > > > > Jira item.
> > > > >
> > > > > On 7/20/07, Todd Orr <[EMAIL PROTECTED]> wrote:
> > > > >> Tap 5.0.5.
> > > > >>
> > > > >> I'm having trouble loading an asset from the classpath. Everywhere
> > > > >> I've looked I see that it should be dead simple. However, when I
> > > > >> attempt to view the image directly in the browser (firefox) I get:
> > > > >>
> > > > >> The image
> > > > >> "http://localhost:8080/testapp/assets/com/test/testapp/web/compone
> > > > >>nts/slider_default_selected.png"
> > > > >>
> > > > >> cannot be displayed, because it contains errors.
> > > > >>
> > > > >>
> > > > >> The code that injects the image is:
> > > > >>
> > > > >> @Inject
> > > > >> @Path("slider_default_selected.png")
> > > > >> //@Path("context:images/slider_default_selected.png") // testing
> > > > >> private Asset defaultSelectedImage;
> > > > >>
> > > > >> ...
> > > > >>
> > > > >> getter too.
> > > > >>
> > > > >>
> > > > >> The template code:
> > > > >>
> > > > >> <img src="${defaultSelectedImage}" />
> > > > >>
> > > > >>
> > > > >> Has anyone run into this before? For testing the code works fine
> > > > >> when using a context relative injection. However, this is not my
> > > > >> ideal choice for packaging.
> > > > >>
> > > > >> Thanks
> > > > >
> > > > > -------------------------------------------------------------------
> > > > >-- To unsubscribe, e-mail: [EMAIL PROTECTED] For
> > > > > additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > --
> > 得与失都是生活



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to