Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade the minimum required Java version to 7 and Plexus IO to 3.0.0 #56

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 3 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
<url>https://github.com/codehaus-plexus/plexus-archiver/issues</url>
</issueManagement>

<properties>
<useJvmChmod>true</useJvmChmod>
</properties>

<contributors>
<contributor>
<name>Dan Tran</name>
Expand Down Expand Up @@ -56,13 +52,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-io</artifactId>
<version>2.7.1</version>
</dependency>
<dependency>
<!-- Upgrade to transitive dependency of 'plexus-io' which is JDK 5+ only. -->
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -114,11 +104,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<useJvmChmod>${useJvmChmod}</useJvmChmod>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about Surefire? That code did not change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useJvmChmod system property is no longer used, so there is no point
in setting it. That is why I've removed it from the Surefire configuration.

</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -166,8 +151,8 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.codehaus.plexus.archiver.manager.ArchiverManager;
import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.components.io.attributes.Java7Reflector;
import org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributes;
import org.codehaus.plexus.components.io.functions.ResourceAttributeSupplier;
import org.codehaus.plexus.components.io.resources.AbstractPlexusIoResourceCollection;
Expand Down Expand Up @@ -363,7 +362,7 @@ public void addFileSet( @Nonnull final FileSet fileSet )

private boolean isSymlinkSupported()
{
return Os.isFamily( Os.FAMILY_UNIX ) && Java7Reflector.isAtLeastJava7();
return Os.isFamily( Os.FAMILY_UNIX );
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ else if ( isDirectory )

if ( !isIgnorePermissions() && mode != null && !isDirectory )
{
ArchiveEntryUtils.chmod( f, mode, getLogger(), isUseJvmChmod() );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger is not necessary anymore?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was used to log the output of the 'chmod' command, so it is no
longer needed.

ArchiveEntryUtils.chmod( f, mode );
}
}
catch ( final FileNotFoundException ex )
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/codehaus/plexus/archiver/Archiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -366,20 +366,22 @@ ResourceIterator getResources()
void setDuplicateBehavior( String duplicate );

/**
* For java7 and above, new java method will be used, regardless of this setting
* to use or not the jvm method for file permissions : user all <b>not active for group permissions</b>
*
* @since 1.1
* @param useJvmChmod
* @deprecated this setting is now ignored. The jvm is always used.
*/
@Deprecated
void setUseJvmChmod( boolean useJvmChmod );

/**
* For java7 and above, new java method will be used, regardless of this setting
*
* @since 1.1
* @return
* @deprecated this setting is now ignored. The jvm is always used.
*/
@Deprecated
boolean isUseJvmChmod();

/**
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/codehaus/plexus/archiver/UnArchiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,17 @@ void extract( String path, File outputDirectory )
*
* @since 1.1
* @param useJvmChmod
* @deprecated this setting is now ignored. The jvm is always used.
*/
@Deprecated
void setUseJvmChmod( boolean useJvmChmod );

/**
* @since 1.1
* @return
* @deprecated this setting is now ignored. The jvm is always used.
*/
@Deprecated
boolean isUseJvmChmod();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.HashMap;
import javax.annotation.Nonnull;
import javax.annotation.WillNotClose;
import org.codehaus.plexus.components.io.attributes.Java7FileAttributes;
import org.codehaus.plexus.components.io.attributes.FileAttributes;
import org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributes;
import org.codehaus.plexus.components.io.resources.PlexusIoCompressedFileResourceCollection;
import org.codehaus.plexus.components.io.resources.PlexusIoResourceCollection;
Expand Down Expand Up @@ -42,7 +42,7 @@ InputStream getInputStream( File file )

@Override protected PlexusIoResourceAttributes getAttributes( File file ) throws IOException
{
return new Java7FileAttributes( file, new HashMap<Integer, String>(), new HashMap<Integer, String>() );
return new FileAttributes( file, new HashMap<Integer, String>(), new HashMap<Integer, String>() );
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ private void setFileModes( ArchiveEntry entry, File outFile, long inLastModified
{
if ( !isIgnorePermissions() )
{
ArchiveEntryUtils.chmod( outFile, entry.getMode(), getLogger(), isUseJvmChmod() );
ArchiveEntryUtils.chmod( outFile, entry.getMode() );
}

outFile.setLastModified( inLastModified == PlexusIoResource.UNKNOWN_MODIFICATION_DATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.zip.GZIPInputStream;
import javax.annotation.Nonnull;
import org.codehaus.plexus.archiver.util.Streams;
import org.codehaus.plexus.components.io.attributes.Java7FileAttributes;
import org.codehaus.plexus.components.io.attributes.FileAttributes;
import org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributes;
import org.codehaus.plexus.components.io.resources.PlexusIoCompressedFileResourceCollection;
import org.codehaus.plexus.util.IOUtil;
Expand Down Expand Up @@ -49,7 +49,7 @@ protected InputStream getInputStream( File file )
protected PlexusIoResourceAttributes getAttributes( File file )
throws IOException
{
return new Java7FileAttributes( file, new HashMap<Integer, String>(), new HashMap<Integer, String>() );
return new FileAttributes( file, new HashMap<Integer, String>(), new HashMap<Integer, String>() );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
import java.io.InputStream;
import java.net.URL;
import javax.annotation.Nonnull;
import org.codehaus.plexus.components.io.attributes.Java7AttributeUtils;
import org.codehaus.plexus.components.io.attributes.Java7Reflector;
import org.codehaus.plexus.components.io.attributes.AttributeUtils;
import org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributes;
import org.codehaus.plexus.components.io.functions.ResourceAttributeSupplier;
import org.codehaus.plexus.components.io.resources.AbstractPlexusIoResource;
Expand Down Expand Up @@ -106,14 +105,7 @@ public long getLastModified()
{
if ( file.exists() )
{
if ( Java7Reflector.isAtLeastJava7() )
{
return Java7AttributeUtils.getLastModified( getFile() );
}
else
{
return getFile().lastModified();
}
return AttributeUtils.getLastModified( getFile() );
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.HashMap;
import javax.annotation.Nonnull;
import javax.annotation.WillNotClose;
import org.codehaus.plexus.components.io.attributes.Java7FileAttributes;
import org.codehaus.plexus.components.io.attributes.FileAttributes;
import org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributes;
import org.codehaus.plexus.components.io.resources.PlexusIoCompressedFileResourceCollection;
import org.codehaus.plexus.util.IOUtil;
Expand Down Expand Up @@ -41,7 +41,7 @@ InputStream getInputStream( File file )

@Override protected PlexusIoResourceAttributes getAttributes( File file ) throws IOException
{
return new Java7FileAttributes( file, new HashMap<Integer, String>(), new HashMap<Integer, String>() );
return new FileAttributes( file, new HashMap<Integer, String>(), new HashMap<Integer, String>() );
}

@Override
Expand Down
Loading