You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Jason van Zyl <ja...@maven.org> on 2008/01/20 07:04:26 UTC

What happened inside the shade plugin with file copying

Why do we have huge chunks of logic for copying files in the shade  
plugin? None of the utility libraries can copy a file correctly?

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
jason at sonatype dot com
----------------------------------------------------------

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.

-- Jacques Ellul, The Technological Society 




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


Re: What happened inside the shade plugin with file copying

Posted by Daniel Kulp <dk...@apache.org>.
On Sunday 20 January 2008, Jason van Zyl wrote:
> On 20-Jan-08, at 9:15 AM, Daniel Kulp wrote:
> > It probably should be switched to using the plexus
> > FileUtils.copyFile(...).   We had the code in there while Dan F. and
> > I were trying to figure out why the renames were not working
> > (MSHADE-5).
>
> Renames where? They don't historically work on Windows across file
> systems, but this should be taken care of in p-u. It wasn't working?

It wasn't accross file systems.   It was files in the target dir.   The 
problem was that in SOME cases, some previous plugins are not closing 
the streams or SOMETHING leaving the jar files locked so they couldn't 
be replaced. (on on Windows)    In SOME cases, just calling System.gc() 
to cause the old streams to be garbage collected allowed the rename to 
work.   In other cases,  the workaround was to overwrite the original 
with the copy if the rename didn't work.   That worked fine.

The problem is that FileUtils.rename attempts to delete the "to" file 
first and throws an exception if it fails.   If it's locked, it won't 
delete and thus won't work.   

Dan


> > Having the code copied in allowed some "println" debugging stuff..
> > Now that that all seems resolved, it should be flipped back.
> >
> > Dan
> >
> >> Thanks,
> >>
> >> Jason
> >>
> >> ----------------------------------------------------------
> >> Jason van Zyl
> >> Founder,  Apache Maven
> >> jason at sonatype dot com
> >> ----------------------------------------------------------
> >>
> >> In short, man creates for himself a new religion of a rational
> >> and technical order to justify his work and to be justified in it.
> >>
> >> -- Jacques Ellul, The Technological Society
> >>
> >>
> >>
> >>
> >> -------------------------------------------------------------------
> >>-- To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: dev-help@maven.apache.org
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer, IONA
> > dkulp@apache.org
> > http://www.dankulp.com/blog
> >
> > --------------------------------------------------------------------
> >- To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> jason at sonatype dot com
> ----------------------------------------------------------
>
> First, the taking in of scattered particulars under one Idea,
> so that everyone understands what is being talked about ... Second,
> the separation of the Idea into parts, by dividing it at the joints,
> as nature directs, not breaking any limb in half as a bad carver
> might.
>
> -- Plato, Phaedrus (Notes on the Synthesis of Form by C. Alexander)
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

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


Re: What happened inside the shade plugin with file copying

Posted by Jason van Zyl <ja...@maven.org>.
On 20-Jan-08, at 9:15 AM, Daniel Kulp wrote:

> On Sunday 20 January 2008, Jason van Zyl wrote:
>> Why do we have huge chunks of logic for copying files in the shade
>> plugin? None of the utility libraries can copy a file correctly?
>
> It probably should be switched to using the plexus
> FileUtils.copyFile(...).   We had the code in there while Dan F. and I
> were trying to figure out why the renames were not working (MSHADE-5).

Renames where? They don't historically work on Windows across file  
systems, but this should be taken care of in p-u. It wasn't working?

>
> Having the code copied in allowed some "println" debugging stuff..
> Now that that all seems resolved, it should be flipped back.
>
> Dan
>
>
>>
>> Thanks,
>>
>> Jason
>>
>> ----------------------------------------------------------
>> Jason van Zyl
>> Founder,  Apache Maven
>> jason at sonatype dot com
>> ----------------------------------------------------------
>>
>> In short, man creates for himself a new religion of a rational
>> and technical order to justify his work and to be justified in it.
>>
>> -- Jacques Ellul, The Technological Society
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>
>
>
> -- 
> J. Daniel Kulp
> Principal Engineer, IONA
> dkulp@apache.org
> http://www.dankulp.com/blog
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
jason at sonatype dot com
----------------------------------------------------------

First, the taking in of scattered particulars under one Idea,
so that everyone understands what is being talked about ... Second,
the separation of the Idea into parts, by dividing it at the joints,
as nature directs, not breaking any limb in half as a bad carver might.

-- Plato, Phaedrus (Notes on the Synthesis of Form by C. Alexander) 




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


Re: What happened inside the shade plugin with file copying

Posted by Daniel Kulp <dk...@apache.org>.
On Sunday 20 January 2008, Jason van Zyl wrote:
> Why do we have huge chunks of logic for copying files in the shade
> plugin? None of the utility libraries can copy a file correctly?

It probably should be switched to using the plexus 
FileUtils.copyFile(...).   We had the code in there while Dan F. and I 
were trying to figure out why the renames were not working (MSHADE-5).   
Having the code copied in allowed some "println" debugging stuff..    
Now that that all seems resolved, it should be flipped back.

Dan


>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> jason at sonatype dot com
> ----------------------------------------------------------
>
> In short, man creates for himself a new religion of a rational
> and technical order to justify his work and to be justified in it.
>
> -- Jacques Ellul, The Technological Society
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

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