2222import org .codehaus .plexus .archiver .ResourceIterator ;
2323import org .codehaus .plexus .archiver .util .ArchiveEntryUtils ;
2424import org .codehaus .plexus .archiver .util .ResourceUtils ;
25+ import org .codehaus .plexus .archiver .UnixStat ;
2526import org .codehaus .plexus .components .io .attributes .SymlinkUtils ;
2627import org .codehaus .plexus .components .io .functions .SymlinkDestinationSupplier ;
2728import org .codehaus .plexus .components .io .resources .PlexusIoResource ;
2829
30+ import java .nio .file .Path ;
31+ import java .nio .file .Paths ;
2932import java .io .File ;
3033import java .io .IOException ;
3134
@@ -141,11 +144,6 @@ protected void copyFile( final ArchiveEntry entry, final String vPath )
141144 }
142145 }
143146 ResourceUtils .copyFile ( entry .getInputStream (), outFile );
144-
145- if ( !isIgnorePermissions () )
146- {
147- ArchiveEntryUtils .chmod ( outFile , entry .getMode (), getLogger (), isUseJvmChmod () );
148- }
149147 }
150148 else
151149 { // file is a directory
@@ -166,6 +164,15 @@ else if ( !outFile.mkdirs() )
166164 }
167165 }
168166
167+ if ( !isIgnorePermissions () )
168+ {
169+ // compute relative path
170+ String relative = outFile .getAbsolutePath ().replaceFirst (getDestFile ().getAbsolutePath (), "." );
171+ getLogger ().info ( "Set chmod " + Integer .toOctalString ( 0x0fff & entry .getMode () ) + " for " + relative );
172+ // call chmod (java or system)
173+ ArchiveEntryUtils .chmod ( outFile , entry .getMode (), getLogger (), isUseJvmChmod () );
174+ }
175+
169176 outFile .setLastModified ( inLastModified == PlexusIoResource .UNKNOWN_MODIFICATION_DATE ? System .currentTimeMillis ()
170177 : inLastModified );
171178 }
0 commit comments