Note, I have also converted the ant log statements in Expand to be commons logging and uncommented them.
Cheers,
Brett
Index: src/java/org/apache/maven/util/Expand.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine-maven/src/java/org/apache/maven/util/Expand.java,v
retrieving revision 1.6
diff -c -r1.6 Expand.java
*** src/java/org/apache/maven/util/Expand.java 31 Dec 2002 07:04:39 -0000 1.6
--- src/java/org/apache/maven/util/Expand.java 9 Jan 2003 21:23:07 -0000
***************
*** 56,61 ****
--- 56,63 ----
* ====================================================================
*/
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
import org.apache.tools.ant.util.FileUtils;
import java.io.File;
***************
*** 88,100 ****
/** Should overwrite flag. */
private boolean overwrite = true;
/**
* Do the work.
*
* @throws Exception If an error occurs.
*/
public void execute()
! throws Exception
{
FileUtils fileUtils = FileUtils.newFileUtils();
expandFile( fileUtils, source, dest );
--- 90,104 ----
/** Should overwrite flag. */
private boolean overwrite = true;
+ private static final Log log = LogFactory.getLog(Expand.class);
+
/**
* Do the work.
*
* @throws Exception If an error occurs.
*/
public void execute()
! throws IOException
{
FileUtils fileUtils = FileUtils.newFileUtils();
expandFile( fileUtils, source, dest );
***************
*** 106,112 ****
* @param srcF The source file.
* @param dir The directory
*/
! protected void expandFile( FileUtils fileUtils, File srcF, File dir )
{
ZipInputStream zis = null;
try
--- 110,116 ----
* @param srcF The source file.
* @param dir The directory
*/
! protected void expandFile( FileUtils fileUtils, File srcF, File dir ) throws
IOException
{
ZipInputStream zis = null;
try
***************
*** 122,133 ****
ze.isDirectory() );
}
! //log("expand complete", Project.MSG_VERBOSE);
! }
! catch ( IOException ioe )
! {
! //throw new BuildException("Error while expanding " + srcF.getPath(),
! // ioe);
}
finally
{
--- 126,132 ----
ze.isDirectory() );
}
! log.info("expand complete");
}
finally
{
***************
*** 164,232 ****
Date entryDate, boolean isDirectory )
throws IOException
{
! try
! {
! File f = fileUtils.resolveFile( dir, entryName );
! if ( !overwrite && f.exists()
! && f.lastModified() >= entryDate.getTime() )
! {
! //log("Skipping " + f + " as it is up-to-date",
! // Project.MSG_DEBUG);
! return;
! }
! //log("expanding " + entryName + " to " + f,
! // Project.MSG_VERBOSE);
! // create intermediary directories - sometimes zip don't add them
! File dirF = f.getParentFile();
! //File dirF = fileUtils.getParentFile(f);
! dirF.mkdirs();
! if ( isDirectory )
{
! f.mkdirs();
}
! else
{
! byte[] buffer = new byte[1024];
! int length = 0;
! FileOutputStream fos = null;
! try
{
! fos = new FileOutputStream( f );
!
! while ( ( length =
! compressedInputStream.read( buffer ) ) >= 0 )
{
! fos.write( buffer, 0, length );
}
!
! fos.close();
! fos = null;
! }
! finally
! {
! if ( fos != null )
{
! try
! {
! fos.close();
! }
! catch ( IOException e )
! {
! // intentionally left blank
! }
}
}
}
-
- fileUtils.setFileLastModified( f, entryDate.getTime() );
- }
- catch (FileNotFoundException e)
- {
- // intentionally left blank??
}
}
/**
--- 163,222 ----
Date entryDate, boolean isDirectory )
throws IOException
{
! File f = fileUtils.resolveFile( dir, entryName );
! if ( !overwrite && f.exists()
! && f.lastModified() >= entryDate.getTime() )
! {
! log.debug("Skipping " + f + " as it is up-to-date");
! return;
! }
! log.info("expanding " + entryName + " to " + f);
! // create intermediary directories - sometimes zip don't add them
! File dirF = f.getParentFile();
! //File dirF = fileUtils.getParentFile(f);
! dirF.mkdirs();
! if ( isDirectory )
! {
! f.mkdirs();
! }
! else
! {
! byte[] buffer = new byte[1024];
! int length = 0;
! FileOutputStream fos = null;
! try
{
! fos = new FileOutputStream( f );
!
! while ( ( length =
! compressedInputStream.read( buffer ) ) >= 0 )
! {
! fos.write( buffer, 0, length );
! }
!
! fos.close();
! fos = null;
}
! finally
{
! if ( fos != null )
{
! try
{
! fos.close();
}
! catch ( IOException e )
{
! // intentionally left blank
}
}
}
}
+
+ fileUtils.setFileLastModified( f, entryDate.getTime() );
}
/**
Index: src/java/org/apache/maven/plugin/PluginManager.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine-maven/src/java/org/apache/maven/plugin/PluginManager.java,v
retrieving revision 1.26
diff -c -r1.26 PluginManager.java
*** src/java/org/apache/maven/plugin/PluginManager.java 8 Jan 2003 20:25:57 -0000
1.26
--- src/java/org/apache/maven/plugin/PluginManager.java 9 Jan 2003 21:22:47 -0000
***************
*** 63,68 ****
--- 63,69 ----
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.maven.AbstractMavenComponent;
+ import org.apache.maven.MavenException;
import org.apache.maven.MavenUtils;
import org.apache.maven.MavenSession;
import org.apache.maven.UnknownGoalException;
***************
*** 230,239 ****
processed.delete();
}
! Expand unzipper = new Expand();
! unzipper.setSrc( files[i] );
! unzipper.setDest( unzipDir );
! unzipper.execute();
}
}
}
--- 231,245 ----
processed.delete();
}
! try {
! Expand unzipper = new Expand();
! unzipper.setSrc( files[i] );
! unzipper.setDest( unzipDir );
! unzipper.execute();
! }
! catch (IOException e) {
! throw new MavenException("Unable to extract plugin: " +
files[i], e);
! }
}
}
}-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
