[MGPG-70] Require Java 7
diff --git a/pom.xml b/pom.xml
index 2afc642..e0a5919 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,6 +63,7 @@
 
   <properties>
     <mavenVersion>2.2.1</mavenVersion>
+    <javaVersion>7</javaVersion>
   </properties>
 
   <dependencies>
diff --git a/src/main/java/org/apache/maven/plugin/gpg/AbstractGpgMojo.java b/src/main/java/org/apache/maven/plugin/gpg/AbstractGpgMojo.java
index cb61615..61fa02f 100644
--- a/src/main/java/org/apache/maven/plugin/gpg/AbstractGpgMojo.java
+++ b/src/main/java/org/apache/maven/plugin/gpg/AbstractGpgMojo.java
@@ -102,7 +102,7 @@
     private boolean defaultKeyring;
 
     /**
-     * <p>The path to a secret keyring to add to the list of keyrings. By default, only the {@code secring.gpg} from 
+     * <p>The path to a secret keyring to add to the list of keyrings. By default, only the {@code secring.gpg} from
      * gpg's home directory is considered. Use this option (in combination with {@link #publicKeyring} and
      * {@link #defaultKeyring} if required) to use a different secret key. <em>Note:</em> Relative paths are resolved
      * against gpg's home directory, not the project base directory.</p>
diff --git a/src/main/java/org/apache/maven/plugin/gpg/AbstractGpgSigner.java b/src/main/java/org/apache/maven/plugin/gpg/AbstractGpgSigner.java
index 49286f1..68c5ba7 100644
--- a/src/main/java/org/apache/maven/plugin/gpg/AbstractGpgSigner.java
+++ b/src/main/java/org/apache/maven/plugin/gpg/AbstractGpgSigner.java
@@ -19,12 +19,8 @@
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStreamReader;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.util.List;
 
 import org.apache.maven.plugin.MojoExecutionException;
@@ -242,7 +238,7 @@
         }
         if ( pass == null )
         {
-            pass = readPassword( "GPG Passphrase: " );
+            pass = new String( readPassword( "GPG Passphrase: " ) );
         }
         if ( project != null )
         {
@@ -251,121 +247,9 @@
         return pass;
     }
 
-    private String readPassword( String prompt )
+    private char[] readPassword( String prompt )
         throws IOException
     {
-        try
-        {
-            return readPasswordJava16( prompt );
-        }
-        catch ( IOException e )
-        {
-            throw e;
-        }
-        catch ( NoSuchMethodException e )
-        {
-            return readPasswordJava15( prompt );
-        }
-        catch ( IllegalAccessException e )
-        {
-            return readPasswordJava15( prompt );
-        }
-        catch ( InvocationTargetException e )
-        {
-            return readPasswordJava15( prompt );
-        }
-    }
-
-    private String readPasswordJava16( String prompt )
-        throws IOException, NoSuchMethodException, InvocationTargetException, IllegalAccessException
-    {
-        Method consoleMethod = System.class.getMethod( "console" );
-        Object console = consoleMethod.invoke( null );
-        if ( console == null )
-        {
-            throw new IllegalAccessException( "console was null" );
-        }
-        Method readPasswordMethod = console.getClass().getMethod( "readPassword", String.class, Object[].class );
-        return new String( (char[]) readPasswordMethod.invoke( console, prompt, null ) );
-    }
-
-    private String readPasswordJava15( String prompt )
-        throws IOException
-    {
-        BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) );
-        while ( System.in.available() != 0 )
-        {
-            // there's some junk already on the input stream, consume it
-            // so we can get the real passphrase
-            System.in.read();
-        }
-
-        System.out.print( prompt );
-        System.out.print( ' ' );
-        MaskingThread thread = new MaskingThread();
-        thread.start();
-        try
-        {
-
-            return in.readLine();
-        }
-        finally
-        {
-            // stop masking
-            thread.stopMasking();
-
-        }
-    }
-
-    // based on ideas from http://java.sun.com/developer/technicalArticles/Security/pwordmask/
-    class MaskingThread
-        extends Thread
-    {
-        private volatile boolean stop;
-
-        /**
-         * Begin masking until asked to stop.
-         */
-        public void run()
-        {
-            // this needs to be high priority to make sure the characters don't
-            // really get to the screen.
-
-            int priority = Thread.currentThread().getPriority();
-            Thread.currentThread().setPriority( Thread.MAX_PRIORITY );
-
-            try
-            {
-                stop = false;
-                while ( !stop )
-                {
-                    // print a backspace + * to overwrite anything they type
-                    System.out.print( "\010*" );
-                    try
-                    {
-                        // attempt masking at this rate
-                        Thread.sleep( 1 );
-                    }
-                    catch ( InterruptedException iex )
-                    {
-                        Thread.currentThread().interrupt();
-                        return;
-                    }
-                }
-            }
-            finally
-            {
-                // restore the original priority
-                Thread.currentThread().setPriority( priority );
-            }
-        }
-
-        /**
-         * Instruct the thread to stop masking.
-         */
-        public void stopMasking()
-        {
-            this.stop = true;
-        }
+        return System.console().readPassword();
     }
 }
diff --git a/src/main/java/org/apache/maven/plugin/gpg/AscArtifactMetadata.java b/src/main/java/org/apache/maven/plugin/gpg/AscArtifactMetadata.java
index 5523769..c4b95b5 100644
--- a/src/main/java/org/apache/maven/plugin/gpg/AscArtifactMetadata.java
+++ b/src/main/java/org/apache/maven/plugin/gpg/AscArtifactMetadata.java
@@ -48,11 +48,13 @@
         this.isPom = isPom;
     }
 
+    @Override
     public String getBaseVersion()
     {
         return artifact.getBaseVersion();
     }
 
+    @Override
     public Object getKey()
     {
         return "gpg signature " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getType()
@@ -80,16 +82,19 @@
         return buf.toString();
     }
 
+    @Override
     public String getLocalFilename( ArtifactRepository repository )
     {
         return getFilename();
     }
 
+    @Override
     public String getRemoteFilename()
     {
         return getFilename();
     }
 
+    @Override
     public void merge( ArtifactMetadata metadata )
     {
         AscArtifactMetadata m = (AscArtifactMetadata) metadata;
@@ -99,6 +104,7 @@
         }
     }
 
+    @Override
     public void storeInLocalRepository( ArtifactRepository localRepository, ArtifactRepository remoteRepository )
         throws RepositoryMetadataStoreException
     {
@@ -116,11 +122,13 @@
         }
     }
 
+    @Override
     public boolean storedInArtifactVersionDirectory()
     {
         return true;
     }
 
+    @Override
     public String toString()
     {
         return getFilename();
diff --git a/src/main/java/org/apache/maven/plugin/gpg/AttachedSignedArtifact.java b/src/main/java/org/apache/maven/plugin/gpg/AttachedSignedArtifact.java
index 3a4d431..964e16f 100644
--- a/src/main/java/org/apache/maven/plugin/gpg/AttachedSignedArtifact.java
+++ b/src/main/java/org/apache/maven/plugin/gpg/AttachedSignedArtifact.java
@@ -22,7 +22,6 @@
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.maven.artifact.Artifact;
@@ -51,264 +50,316 @@
         this.signature = signature;
     }
 
+    @Override
     public void setArtifactId( String artifactId )
     {
         delegate.setArtifactId( artifactId );
     }
 
-    public List getAvailableVersions()
+    @Override
+    public List<ArtifactVersion> getAvailableVersions()
     {
         return delegate.getAvailableVersions();
     }
 
-    public void setAvailableVersions( List availableVersions )
+    @Override
+    public void setAvailableVersions( List<ArtifactVersion> availableVersions )
     {
         delegate.setAvailableVersions( availableVersions );
     }
 
+    @Override
     public String getBaseVersion()
     {
         return delegate.getBaseVersion();
     }
 
+    @Override
     public void setBaseVersion( String baseVersion )
     {
         delegate.setBaseVersion( baseVersion );
     }
 
+    @Override
     public String getDownloadUrl()
     {
         return delegate.getDownloadUrl();
     }
 
+    @Override
     public void setDownloadUrl( String downloadUrl )
     {
         delegate.setDownloadUrl( downloadUrl );
     }
 
+    @Override
     public void setGroupId( String groupId )
     {
         delegate.setGroupId( groupId );
     }
 
+    @Override
     public ArtifactRepository getRepository()
     {
         return delegate.getRepository();
     }
 
+    @Override
     public void setRepository( ArtifactRepository repository )
     {
         delegate.setRepository( repository );
     }
 
+    @Override
     public String getScope()
     {
         return delegate.getScope();
     }
 
+    @Override
     public void setScope( String scope )
     {
         delegate.setScope( scope );
     }
 
+    @Override
     public String getVersion()
     {
         return delegate.getVersion();
     }
 
+    @Override
     public void setVersion( String version )
     {
         delegate.setVersion( version );
     }
 
+    @Override
     public VersionRange getVersionRange()
     {
         return delegate.getVersionRange();
     }
 
+    @Override
     public void setVersionRange( VersionRange range )
     {
         delegate.setVersionRange( range );
     }
 
+    @Override
     public boolean isRelease()
     {
         return delegate.isRelease();
     }
 
+    @Override
     public void setRelease( boolean release )
     {
         delegate.setRelease( release );
     }
 
+    @Override
     public boolean isSnapshot()
     {
         return delegate.isSnapshot();
     }
 
+    @Override
     public void addMetadata( ArtifactMetadata metadata )
     {
         delegate.addMetadata( metadata );
     }
 
+    @Override
     public String getClassifier()
     {
         return delegate.getClassifier();
     }
 
+    @Override
     public boolean hasClassifier()
     {
         return delegate.hasClassifier();
     }
 
+    @Override
     public String getGroupId()
     {
         return delegate.getGroupId();
     }
 
+    @Override
     public String getArtifactId()
     {
         return delegate.getArtifactId();
     }
 
+    @Override
     public String getType()
     {
         return delegate.getType();
     }
 
+    @Override
     public void setFile( File file )
     {
         delegate.setFile( file );
     }
 
+    @Override
     public File getFile()
     {
         return delegate.getFile();
     }
 
+    @Override
     public String getId()
     {
         return delegate.getId();
     }
 
+    @Override
     public String getDependencyConflictId()
     {
         return delegate.getDependencyConflictId();
     }
 
+    @Override
     public String toString()
     {
         return delegate.toString();
     }
 
+    @Override
     public int hashCode()
     {
         return delegate.hashCode();
     }
 
+    @Override
     public boolean equals( Object o )
     {
         return delegate.equals( o );
     }
 
+    @Override
     public void updateVersion( String version, ArtifactRepository localRepository )
     {
         delegate.updateVersion( version, localRepository );
     }
 
+    @Override
     public ArtifactFilter getDependencyFilter()
     {
         return delegate.getDependencyFilter();
     }
 
+    @Override
     public void setDependencyFilter( ArtifactFilter artifactFilter )
     {
         delegate.setDependencyFilter( artifactFilter );
     }
 
+    @Override
     public ArtifactHandler getArtifactHandler()
     {
         return delegate.getArtifactHandler();
     }
 
-    public List getDependencyTrail()
+    @Override
+    public List<String> getDependencyTrail()
     {
         return delegate.getDependencyTrail();
     }
 
-    public void setDependencyTrail( List dependencyTrail )
+    @Override
+    public void setDependencyTrail( List<String> dependencyTrail )
     {
         delegate.setDependencyTrail( dependencyTrail );
     }
 
+    @Override
     public void selectVersion( String version )
     {
         delegate.selectVersion( version );
     }
 
+    @Override
     public void setResolved( boolean resolved )
     {
         delegate.setResolved( resolved );
     }
 
+    @Override
     public boolean isResolved()
     {
         return delegate.isResolved();
     }
 
+    @Override
     public void setResolvedVersion( String version )
     {
         delegate.setResolvedVersion( version );
     }
 
+    @Override
     public void setArtifactHandler( ArtifactHandler artifactHandler )
     {
         delegate.setArtifactHandler( artifactHandler );
     }
 
+    @Override
     public boolean isOptional()
     {
         return delegate.isOptional();
     }
 
+    @Override
     public ArtifactVersion getSelectedVersion()
         throws OverConstrainedVersionException
     {
         return delegate.getSelectedVersion();
     }
 
+    @Override
     public boolean isSelectedVersionKnown()
         throws OverConstrainedVersionException
     {
         return delegate.isSelectedVersionKnown();
     }
 
+    @Override
     public void setOptional( boolean optional )
     {
         delegate.setOptional( optional );
     }
 
+    @Override
     public Collection<ArtifactMetadata> getMetadataList()
     {
-        List<ArtifactMetadata> result = new ArrayList<ArtifactMetadata>( delegate.getMetadataList() );
-        boolean alreadySigned = false;
-        for ( Iterator i = result.iterator(); i.hasNext() && !alreadySigned; )
+        List<ArtifactMetadata> result = new ArrayList<>( delegate.getMetadataList() );
+
+        for ( ArtifactMetadata metadata : result )
         {
-            ArtifactMetadata metadata = (ArtifactMetadata) i.next();
-            alreadySigned = signature.getKey().equals( metadata.getKey() );
+            if ( signature.getKey().equals( metadata.getKey() ) )
+            {
+                // already signed
+                return result;
+            }
         }
-        if ( !alreadySigned )
-        {
-            result.add( signature );
-        }
+
+        result.add( signature );
+
         return result;
     }
 
+    @Override
     public int compareTo( Artifact o )
     {
         return delegate.compareTo( o );
     }
 
+    @Override
     public ArtifactMetadata getMetadata( Class<?> metadataClass )
     {
         // TODO Auto-generated method stub
diff --git a/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java b/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java
index eccc716..b631eba 100644
--- a/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java
+++ b/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java
@@ -38,7 +38,7 @@
 
 /**
  * Sign project artifact, the POM, and attached artifacts with GnuPG for deployment.
- * 
+ *
  * @author Jason van Zyl
  * @author Jason Dillon
  * @author Daniel Kulp
@@ -85,6 +85,7 @@
     @Component
     private MavenProjectHelper projectHelper;
 
+    @Override
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
@@ -121,7 +122,7 @@
         signer.setBuildDirectory( new File( project.getBuild().getDirectory() ) );
         signer.setBaseDirectory( project.getBasedir() );
 
-        List signingBundles = new ArrayList();
+        List<SigningBundle> signingBundles = new ArrayList<>();
 
         if ( !"pom".equals( project.getPackaging() ) )
         {
@@ -205,18 +206,16 @@
         // Attach all the signatures
         // ----------------------------------------------------------------------------
 
-        for ( Object signingBundle : signingBundles )
+        for ( SigningBundle bundle : signingBundles )
         {
-            SigningBundle bundle = (SigningBundle) signingBundle;
-
-            projectHelper.attachArtifact( project, bundle.getExtension() + GpgSigner.SIGNATURE_EXTENSION,
+            projectHelper.attachArtifact( project, bundle.getExtension() + AbstractGpgSigner.SIGNATURE_EXTENSION,
                                           bundle.getClassifier(), bundle.getSignature() );
         }
     }
 
     /**
      * Tests whether or not a name matches against at least one exclude pattern.
-     * 
+     *
      * @param name The name to match. Must not be <code>null</code>.
      * @return <code>true</code> when the name matches against at least one exclude pattern, or <code>false</code>
      *         otherwise.
diff --git a/src/main/java/org/apache/maven/plugin/gpg/GpgSigner.java b/src/main/java/org/apache/maven/plugin/gpg/GpgSigner.java
index 0fb63a8..a46bc2c 100644
--- a/src/main/java/org/apache/maven/plugin/gpg/GpgSigner.java
+++ b/src/main/java/org/apache/maven/plugin/gpg/GpgSigner.java
@@ -65,11 +65,11 @@
         {
             cmd.setExecutable( "gpg" + ( Os.isFamily( Os.FAMILY_WINDOWS ) ? ".exe" : "" ) );
         }
-        
+
         GpgVersionParser versionParser = GpgVersionParser.parse( executable );
-        
+
         GpgVersion gpgVersion = versionParser.getGpgVersion();
-        
+
         getLog().debug( gpgVersion.toString() );
 
         if ( args != null )
@@ -140,7 +140,7 @@
 
         if ( StringUtils.isNotEmpty( secretKeyring ) )
         {
-            if ( gpgVersion.isBefore( GpgVersion.parse( "2.1" ) ) ) 
+            if ( gpgVersion.isBefore( GpgVersion.parse( "2.1" ) ) )
             {
                 cmd.createArg().setValue( "--secret-keyring" );
                 cmd.createArg().setValue( secretKeyring );
diff --git a/src/main/java/org/apache/maven/plugin/gpg/GpgVersion.java b/src/main/java/org/apache/maven/plugin/gpg/GpgVersion.java
index 49010ab..c8367dc 100644
--- a/src/main/java/org/apache/maven/plugin/gpg/GpgVersion.java
+++ b/src/main/java/org/apache/maven/plugin/gpg/GpgVersion.java
@@ -23,19 +23,19 @@
 import java.util.regex.Pattern;
 
 /**
- * 
+ *
  * @author Robert Scholte
  * @since 3.0.0
  */
 public class GpgVersion implements Comparable<GpgVersion>
 {
     private final String rawVersion;
-    
+
     private GpgVersion( String rawVersion )
     {
         this.rawVersion = rawVersion;
     }
-    
+
     public static GpgVersion parse( String rawVersion )
     {
         return new GpgVersion( rawVersion );
@@ -45,51 +45,51 @@
     public int compareTo( GpgVersion other )
     {
         Pattern p = Pattern.compile( "([.\\d]+)$" );
-        
+
         String[] thisSegments;
         Matcher m = p.matcher( rawVersion );
         if ( m.find() )
         {
             thisSegments  = m.group( 1 ).split( "\\." );
         }
-        else 
+        else
         {
-          throw new IllegalArgumentException( "Can't parse version of " + this.rawVersion );   
+          throw new IllegalArgumentException( "Can't parse version of " + this.rawVersion );
         }
-        
+
         String[] otherSegments;
         m = p.matcher( other.rawVersion );
         if ( m.find() )
         {
             otherSegments  = m.group( 1 ).split( "\\." );
         }
-        else 
+        else
         {
-          throw new IllegalArgumentException( "Can't parse version of " + other.rawVersion );   
+          throw new IllegalArgumentException( "Can't parse version of " + other.rawVersion );
         }
-        
+
         int minSegments = Math.min( thisSegments.length, otherSegments.length );
-        
+
         for ( int index = 0; index < minSegments; index++ )
         {
             int thisValue = Integer.parseInt( thisSegments[index] );
-            
+
             int otherValue = Integer.parseInt( otherSegments[index] );
-            
+
             int compareValue = Integer.compare( thisValue, otherValue );
-            
+
             if ( compareValue != 0 )
             {
                 return compareValue;
             }
         }
-        
+
         return ( thisSegments.length - otherSegments.length );
     }
 
     /**
      * Verify if this version is before some other version
-     * 
+     *
      * @param other the version to compare with
      * @return {@code true} is this is less than {@code other}, otherwise {@code false}
      */
@@ -100,7 +100,7 @@
 
     /**
      * Verify if this version is before some other version
-     * 
+     *
      * @param other the version to compare with
      * @return {@code true}  is this is less than {@code other}, otherwise {@code false}
      */
@@ -111,7 +111,7 @@
 
     /**
      * Verify if this version is at least some other version
-     * 
+     *
      * @param other the version to compare with
      * @return  {@code true}  is this is greater than or equal to {@code other}, otherwise {@code false}
      */
@@ -122,7 +122,7 @@
 
     /**
      * Verify if this version is at least some other version
-     * 
+     *
      * @param other the version to compare with
      * @return  {@code true} is this is greater than or equal to {@code other}, otherwise {@code false}
      */
@@ -130,11 +130,11 @@
     {
         return this.compareTo( parse( other ) ) >= 0;
     }
-    
+
     @Override
     public String toString()
     {
         return rawVersion;
     }
-    
+
 }
diff --git a/src/main/java/org/apache/maven/plugin/gpg/GpgVersionParser.java b/src/main/java/org/apache/maven/plugin/gpg/GpgVersionParser.java
index 7ec7b69..378d347 100644
--- a/src/main/java/org/apache/maven/plugin/gpg/GpgVersionParser.java
+++ b/src/main/java/org/apache/maven/plugin/gpg/GpgVersionParser.java
@@ -31,20 +31,20 @@
 import org.codehaus.plexus.util.cli.StreamConsumer;
 
 /**
- * 
+ *
  * @author Robert Scholte
  * @since 3.0.0
  */
 public class GpgVersionParser
 {
     private final GpgVersionConsumer consumer;
-    
+
     private GpgVersionParser( GpgVersionConsumer consumer )
     {
         this.consumer = consumer;
-        
+
     }
-    
+
     public static GpgVersionParser parse( String executable )
     {
         Commandline cmd = new Commandline();
@@ -58,11 +58,11 @@
             cmd.setExecutable( "gpg" + ( Os.isFamily( Os.FAMILY_WINDOWS ) ? ".exe" : "" ) );
         }
 
-        
+
         cmd.createArg().setValue( "--version" );
-        
+
         GpgVersionConsumer out = new GpgVersionConsumer();
-        
+
         try
         {
            CommandLineUtils.executeCommandLine( cmd, null, out, null );
@@ -71,10 +71,10 @@
         {
             // TODO probably a dedicated exception
         }
-        
+
         return new GpgVersionParser( out );
     }
-    
+
     public GpgVersion getGpgVersion()
     {
         return consumer.gpgVersion;
@@ -83,7 +83,7 @@
 
     /**
      * Consumes the output of {@code gpg --version}
-     * 
+     *
      * @author Robert Scholte
      * @since 3.0.0
      */
@@ -93,7 +93,7 @@
         private final Pattern gpgVersionPattern = Pattern.compile( "gpg \\(GnuPG\\) .+" );
 
         private GpgVersion gpgVersion;
-        
+
         @Override
         public void consumeLine( String line )
             throws IOException
diff --git a/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java b/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java
index 9090bde..9b0838e 100644
--- a/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java
@@ -50,7 +50,6 @@
 import org.apache.maven.project.validation.ModelValidationResult;
 import org.apache.maven.project.validation.ModelValidator;
 import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.WriterFactory;
@@ -58,7 +57,7 @@
 
 /**
  * Signs artifacts and installs the artifact in the remote repository.
- * 
+ *
  * @author Daniel Kulp
  * @since 1.0-beta-4
  */
@@ -174,7 +173,7 @@
      * Map that contains the layouts.
      */
     @Component( role = ArtifactRepositoryLayout.class )
-    private Map repositoryLayouts;
+    private Map<String, ArtifactRepositoryLayout> repositoryLayouts;
 
     /**
      * Component used to create an artifact
@@ -283,6 +282,7 @@
         }
     }
 
+    @Override
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
@@ -304,7 +304,7 @@
             throw new MojoFailureException( file.getPath() + " not found." );
         }
 
-        ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) repositoryLayouts.get( repositoryLayout );
+        ArtifactRepositoryLayout layout = repositoryLayouts.get( repositoryLayout );
         if ( layout == null )
         {
             throw new MojoFailureException( "Invalid repository layout: " + repositoryLayout );
@@ -479,7 +479,7 @@
     /**
      * Gets the path of the specified artifact within the local repository. Note that the returned path need not exist
      * (yet).
-     * 
+     *
      * @param artifact The artifact whose local repo path should be determined, must not be <code>null</code>.
      * @return The absolute path to the artifact when installed, never <code>null</code>.
      */
@@ -526,7 +526,7 @@
 
     /**
      * Extract the model from the specified POM file.
-     * 
+     *
      * @param pomFile The path of the POM file to parse, must not be <code>null</code>.
      * @return The model from the POM file, never <code>null</code>.
      * @throws MojoExecutionException If the file doesn't exist of cannot be read.
@@ -534,13 +534,9 @@
     private Model readModel( File pomFile )
         throws MojoExecutionException
     {
-        Reader reader = null;
-        try
+        try ( Reader reader = ReaderFactory.newXmlReader( pomFile ) )
         {
-            reader = ReaderFactory.newXmlReader( pomFile );
             final Model model = new MavenXpp3Reader().read( reader );
-            reader.close();
-            reader = null;
             return model;
         }
         catch ( FileNotFoundException e )
@@ -555,15 +551,11 @@
         {
             throw new MojoExecutionException( "Error parsing POM " + pomFile, e );
         }
-        finally
-        {
-            IOUtil.close( reader );
-        }
     }
 
     /**
      * Generates a minimal POM from the user-supplied artifact information.
-     * 
+     *
      * @return The path to the generated POM file, never <code>null</code>.
      * @throws MojoExecutionException If the generation failed.
      */
@@ -571,19 +563,16 @@
         throws MojoExecutionException
     {
         Model model = generateModel();
-
-        Writer fw = null;
-        try
+        
+        try 
         {
             File tempFile = File.createTempFile( "mvndeploy", ".pom" );
             tempFile.deleteOnExit();
 
-            fw = WriterFactory.newXmlWriter( tempFile );
-
-            new MavenXpp3Writer().write( fw, model );
-
-            fw.close();
-            fw = null;
+            try ( Writer fw = WriterFactory.newXmlWriter( tempFile ) )
+            {
+                new MavenXpp3Writer().write( fw, model );
+            }
 
             return tempFile;
         }
@@ -591,15 +580,11 @@
         {
             throw new MojoExecutionException( "Error writing temporary pom file: " + e.getMessage(), e );
         }
-        finally
-        {
-            IOUtil.close( fw );
-        }
     }
 
     /**
      * Validates the user-supplied artifact information.
-     * 
+     *
      * @throws MojoFailureException If any artifact coordinate is invalid.
      */
     private void validateArtifactInformation()