You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2019/03/17 11:33:00 UTC

[maven-deploy-plugin] branch MDEPLOY-244 updated (7ecefab -> 03dc18d)

This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a change to branch MDEPLOY-244
in repository https://gitbox.apache.org/repos/asf/maven-deploy-plugin.git.


 discard 7ecefab  [MDEPLOY-244] - maven deploy plugin 3.0.0-M1 breaks RPM deploys
     new 03dc18d  [MDEPLOY-244] - maven deploy plugin 3.0.0-M1 breaks RPM deploys

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (7ecefab)
            \
             N -- N -- N   refs/heads/MDEPLOY-244 (03dc18d)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../maven/plugins/deploy/AbstractDeployMojo.java   |   6 +-
 .../apache/maven/plugins/deploy/DeployMojo.java    |  36 +-
 .../maven/plugins/deploy/DeployMojoTest.java       | 427 +++++++++++----------
 3 files changed, 256 insertions(+), 213 deletions(-)


[maven-deploy-plugin] 01/01: [MDEPLOY-244] - maven deploy plugin 3.0.0-M1 breaks RPM deploys

Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch MDEPLOY-244
in repository https://gitbox.apache.org/repos/asf/maven-deploy-plugin.git

commit 03dc18dbd4be7d7d62c118ea07b02120593ea6a6
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sat Oct 13 13:05:55 2018 +0200

    [MDEPLOY-244] - maven deploy plugin 3.0.0-M1 breaks RPM deploys
---
 .../maven/plugins/deploy/AbstractDeployMojo.java   |   6 +-
 .../apache/maven/plugins/deploy/DeployMojo.java    |  73 +++-
 src/site/apt/index.apt.vm                          |   2 +-
 .../maven/plugins/deploy/DeployMojoTest.java       | 436 ++++++++++++---------
 4 files changed, 310 insertions(+), 207 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java b/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java
index c0efde1..6d9bade 100644
--- a/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java
+++ b/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java
@@ -29,7 +29,7 @@ import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugins.annotations.Parameter;
 
 /**
- * @version $Id$
+ * Base class for DeployMojo.
  */
 public abstract class AbstractDeployMojo
     extends AbstractMojo
@@ -55,7 +55,7 @@ public abstract class AbstractDeployMojo
     
     /* Setters and Getters */
 
-    void failIfOffline()
+    protected void failIfOffline()
         throws MojoFailureException
     {
         if ( offline )
@@ -64,7 +64,7 @@ public abstract class AbstractDeployMojo
         }
     }
 
-    int getRetryFailedDeploymentCount()
+    protected int getRetryFailedDeploymentCount()
     {
         return retryFailedDeploymentCount;
     }
diff --git a/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java b/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
index 5953d6e..1480bb8 100644
--- a/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
+++ b/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
@@ -55,6 +55,8 @@ public class DeployMojo
 
     private static final Pattern ALT_REPO_SYNTAX_PATTERN = Pattern.compile( "(.+)::(.+)" );
 
+    private static final Pattern OLD_ALT_REPO_SYNTAX_PATTERN = Pattern.compile( "(.+)::(.+)::(.+)" );
+
     /**
      * When building with multiple threads, reaching the last project doesn't have to mean that all projects are ready
      * to be deployed
@@ -85,26 +87,29 @@ public class DeployMojo
     /**
      * Specifies an alternative repository to which the project artifacts should be deployed ( other than those
      * specified in &lt;distributionManagement&gt; ). <br/>
-     * Format: <code>id::url</code>
      * <dl>
      * <dt>id</dt>
      * <dd>The id can be used to pick up the correct credentials from the settings.xml</dd>
      * <dt>url</dt>
      * <dd>The location of the repository</dd>
      * </dl>
+     * <p>
      * <b>Note:</b> In version 2, the format was <code>id::layout::url</code>, but since 3.0.0 the layout part has been
      * removed because Maven 3 only supports <code>default</code> (ie. Maven 2) layout and not <code>legacy</code>
      * (Maven 1) layout.</b>
+     * </p>
      */
     @Parameter( property = "altDeploymentRepository" )
     private String altDeploymentRepository;
 
     /**
      * The alternative repository to use when the project has a snapshot version.
-     *
+     * <p>
      * <b>Note:</b> In version 2, the format was <code>id::layout::url</code>, but since 3.0.0 the layout part has been
      * removed because Maven 3 only supports <code>default</code> (ie. Maven 2) layout and not <code>legacy</code>
      * (Maven 1) layout.</b>
+     * </p>
+     * 
      * @since 2.8
      * @see DeployMojo#altDeploymentRepository
      */
@@ -113,10 +118,12 @@ public class DeployMojo
 
     /**
      * The alternative repository to use when the project has a final version.
-     *
+     * <p>
      * <b>Note:</b> In version 2, the format was <code>id::layout::url</code>, but since 3.0.0 the layout part has been
      * removed because Maven 3 only supports <code>default</code> (ie. Maven 2) layout and not <code>legacy</code>
      * (Maven 1) layout.</b>
+     * </p>
+     * 
      * @since 2.8
      * @see DeployMojo#altDeploymentRepository
      */
@@ -140,6 +147,8 @@ public class DeployMojo
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
+        checkParameterForOldRepositorySyntax();
+
         boolean addedDeployRequest = false;
         if ( skip )
         {
@@ -194,7 +203,7 @@ public class DeployMojo
     }
 
     private void deployProject( ProjectBuildingRequest pbr, ProjectDeployerRequest pir, ArtifactRepository repo )
-        throws MojoFailureException, MojoExecutionException
+        throws MojoExecutionException
     {
         try
         {
@@ -211,16 +220,13 @@ public class DeployMojo
 
     }
 
-    ArtifactRepository getDeploymentRepository( ProjectDeployerRequest pdr )
-
-        throws MojoExecutionException, MojoFailureException
+    private String getAlternateDeploymentRepository( ProjectDeployerRequest pdr )
     {
-        MavenProject project = pdr.getProject();
         String altDeploymentRepository = pdr.getAltDeploymentRepository();
         String altReleaseDeploymentRepository = pdr.getAltReleaseDeploymentRepository();
         String altSnapshotDeploymentRepository = pdr.getAltSnapshotDeploymentRepository();
 
-        ArtifactRepository repo = null;
+        MavenProject project = pdr.getProject();
 
         String altDeploymentRepo;
         if ( ArtifactUtils.isSnapshot( project.getVersion() ) && altSnapshotDeploymentRepository != null )
@@ -235,25 +241,33 @@ public class DeployMojo
         {
             altDeploymentRepo = altDeploymentRepository;
         }
+        return altDeploymentRepo;
+    }
+
+    ArtifactRepository getDeploymentRepository( ProjectDeployerRequest pdr )
 
+        throws MojoExecutionException, MojoFailureException
+    {
+        MavenProject project = pdr.getProject();
+
+        String altDeploymentRepo = getAlternateDeploymentRepository( pdr );
+
+        ArtifactRepository repo = null;
         if ( altDeploymentRepo != null )
         {
             getLog().info( "Using alternate deployment repository " + altDeploymentRepo );
 
             Matcher matcher = ALT_REPO_SYNTAX_PATTERN.matcher( altDeploymentRepo );
-
             if ( !matcher.matches() )
             {
                 throw new MojoFailureException( altDeploymentRepo, "Invalid syntax for repository.",
                                                 "Invalid syntax for alternative repository. Use \"id::url\"." );
             }
-            else
-            {
-                String id = matcher.group( 1 ).trim();
-                String url = matcher.group( 2 ).trim();
 
-                repo = createDeploymentArtifactRepository( id, url );
-            }
+            String id = matcher.group( 1 ).trim();
+            String url = matcher.group( 2 ).trim();
+
+            repo = createDeploymentArtifactRepository( id, url );
         }
 
         if ( repo == null )
@@ -272,4 +286,31 @@ public class DeployMojo
         return repo;
     }
 
+    void checkParameterForOldRepositorySyntax()
+        throws MojoFailureException
+    {
+        checkForOldRepositorySyntax( altReleaseDeploymentRepository, "altReleaseDeploymentRepository" );
+        checkForOldRepositorySyntax( altDeploymentRepository, "altDeploymentRepository" );
+        checkForOldRepositorySyntax( altSnapshotDeploymentRepository, "altSnapshotDeploymentRepository" );
+    }
+
+    void checkForOldRepositorySyntax( String repository, String parameterName )
+        throws MojoFailureException
+    {
+        if ( repository != null )
+        {
+            if ( matchesOldSyntax( repository ) )
+            {
+                throw new MojoFailureException( repository,
+                                                "The syntax for the " + parameterName + " has been changed.",
+                                                "Please use \"id::url\" instead of \"id::layout::url\"." );
+            }
+        }
+    }
+
+    private boolean matchesOldSyntax( String repo )
+    {
+        return OLD_ALT_REPO_SYNTAX_PATTERN.matcher( repo ).matches();
+    }
+
 }
diff --git a/src/site/apt/index.apt.vm b/src/site/apt/index.apt.vm
index a23f6a0..2616c71 100644
--- a/src/site/apt/index.apt.vm
+++ b/src/site/apt/index.apt.vm
@@ -92,7 +92,7 @@ ${project.name}
 
   []
 
-  As of Maven 3, snapshot artifacts will always be deployed using a timestamped version.
+  As of Maven 3, snapshot artifacts will always be deployed using a time stamped version.
 
 * Usage
 
diff --git a/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java b/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
index 6c6f938..48b0bc6 100644
--- a/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
@@ -32,6 +32,7 @@ import java.util.Properties;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
 import org.apache.maven.plugins.deploy.stubs.ArtifactDeployerStub;
@@ -53,22 +54,22 @@ import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
  */
 public class DeployMojoTest
     extends AbstractMojoTestCase
-{    
+{
     private File remoteRepo;
-    
+
     private File localRepo;
-    
+
     private String LOCAL_REPO = getBasedir() + "/target/local-repo";
-    
+
     private String REMOTE_REPO = getBasedir() + "/target/remote-repo";
-    
+
     DeployArtifactStub artifact;
-    
+
     MavenProjectStub project = new MavenProjectStub();
 
     @Mock
     private MavenSession session;
-    
+
     @InjectMocks
     private DeployMojo mojo;
 
@@ -76,11 +77,11 @@ public class DeployMojoTest
         throws Exception
     {
         super.setUp();
-        
+
         remoteRepo = new File( REMOTE_REPO );
-        
-        remoteRepo.mkdirs();  
-        
+
+        remoteRepo.mkdirs();
+
         localRepo = new File( LOCAL_REPO );
 
         if ( localRepo.exists() )
@@ -92,84 +93,82 @@ public class DeployMojoTest
         {
             FileUtils.deleteDirectory( remoteRepo );
         }
-        
-        
+
     }
 
     public void tearDown()
         throws Exception
     {
         super.tearDown();
-        
-        if( remoteRepo.exists() )
+
+        if ( remoteRepo.exists() )
         {
-            //FileUtils.deleteDirectory( remoteRepo );
+            // FileUtils.deleteDirectory( remoteRepo );
         }
     }
-    
+
     public void testDeployTestEnvironment()
         throws Exception
     {
-        File testPom = new File( getBasedir(),
-                                 "target/test-classes/unit/basic-deploy-test/plugin-config.xml" );
-    
-        DeployMojo mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
-    
+        File testPom = new File( getBasedir(), "target/test-classes/unit/basic-deploy-test/plugin-config.xml" );
+
+        DeployMojo mojo = (DeployMojo) lookupMojo( "deploy", testPom );
+
         assertNotNull( mojo );
     }
-    
+
     public void testBasicDeploy()
         throws Exception
     {
         File testPom = new File( getBasedir(), "target/test-classes/unit/basic-deploy-test/plugin-config.xml" );
 
-        mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
-        
+        mojo = (DeployMojo) lookupMojo( "deploy", testPom );
+
         MockitoAnnotations.initMocks( this );
-        
+
         assertNotNull( mojo );
-        
-        ProjectBuildingRequest buildingRequest = mock ( ProjectBuildingRequest.class );
+
+        ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class );
         when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest );
         MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession();
         repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( LOCAL_REPO ) );
         when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession );
-        
-        File file = new File( getBasedir(),
-                              "target/test-classes/unit/basic-deploy-test/target/" +
-                              "deploy-test-file-1.0-SNAPSHOT.jar" );
+
+        File file =
+            new File( getBasedir(),
+                      "target/test-classes/unit/basic-deploy-test/target/" + "deploy-test-file-1.0-SNAPSHOT.jar" );
 
         assertTrue( file.exists() );
 
         MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" );
-        
+
         setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) );
-        
-        artifact = ( DeployArtifactStub ) project.getArtifact();
+
+        artifact = (DeployArtifactStub) project.getArtifact();
 
         String packaging = project.getPackaging();
-        
+
         assertEquals( "jar", packaging );
-        
-        artifact.setFile( file );        
-        
+
+        artifact.setFile( file );
+
         ArtifactRepositoryStub repo = getRepoStub( mojo );
 
         assertNotNull( repo );
-        
+
         repo.setAppendToUrl( "basic-deploy-test" );
-        
+
         assertEquals( "deploy-test", repo.getId() );
         assertEquals( "deploy-test", repo.getKey() );
         assertEquals( "file", repo.getProtocol() );
         assertEquals( "file://" + getBasedir() + "/target/remote-repo/basic-deploy-test", repo.getUrl() );
-        
+
         mojo.execute();
 
-        //check the artifact in local repository
+        // check the artifact in local repository
         List<String> expectedFiles = new ArrayList<String>();
         List<String> fileList = new ArrayList<String>();
-        
+
         expectedFiles.add( "org" );
         expectedFiles.add( "apache" );
         expectedFiles.add( "maven" );
@@ -184,23 +183,24 @@ public class DeployMojoTest
         // extra Aether files
         expectedFiles.add( "resolver-status.properties" );
         expectedFiles.add( "resolver-status.properties" );
-        
+
         File localRepo = new File( LOCAL_REPO, "" );
-        
+
         File[] files = localRepo.listFiles();
 
-        for (File file2 : files) {
-            addFileToList(file2, fileList);
+        for ( File file2 : files )
+        {
+            addFileToList( file2, fileList );
         }
-        
+
         assertEquals( expectedFiles.size(), fileList.size() );
 
-        assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );        
-                  
-        //check the artifact in remote repository
+        assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );
+
+        // check the artifact in remote repository
         expectedFiles = new ArrayList<String>();
         fileList = new ArrayList<String>();
-        
+
         expectedFiles.add( "org" );
         expectedFiles.add( "apache" );
         expectedFiles.add( "maven" );
@@ -220,18 +220,19 @@ public class DeployMojoTest
         expectedFiles.add( "maven-metadata.xml" );
         expectedFiles.add( "maven-metadata.xml.md5" );
         expectedFiles.add( "maven-metadata.xml.sha1" );
-        
+
         remoteRepo = new File( remoteRepo, "basic-deploy-test" );
-        
+
         files = remoteRepo.listFiles();
 
-        for (File file1 : files) {
-            addFileToList(file1, fileList);
+        for ( File file1 : files )
+        {
+            addFileToList( file1, fileList );
         }
-        
+
         assertEquals( expectedFiles.size(), fileList.size() );
 
-        assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );         
+        assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );
     }
 
     public void testSkippingDeploy()
@@ -243,13 +244,14 @@ public class DeployMojoTest
 
         assertNotNull( mojo );
 
-        File file = new File( getBasedir(), "target/test-classes/unit/basic-deploy-test/target/"
-            + "deploy-test-file-1.0-SNAPSHOT.jar" );
+        File file =
+            new File( getBasedir(),
+                      "target/test-classes/unit/basic-deploy-test/target/" + "deploy-test-file-1.0-SNAPSHOT.jar" );
 
         assertTrue( file.exists() );
 
         MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" );
-        
+
         setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) );
 
         artifact = (DeployArtifactStub) project.getArtifact();
@@ -272,7 +274,7 @@ public class DeployMojoTest
         assertEquals( "file://" + getBasedir() + "/target/remote-repo/basic-deploy-test", repo.getUrl() );
 
         setVariableValueToObject( mojo, "skip", Boolean.TRUE );
-        
+
         mojo.execute();
 
         File localRepo = new File( LOCAL_REPO, "" );
@@ -280,57 +282,56 @@ public class DeployMojoTest
         File[] files = localRepo.listFiles();
 
         assertNull( files );
-       
+
         remoteRepo = new File( remoteRepo, "basic-deploy-test" );
 
         files = remoteRepo.listFiles();
 
         assertNull( files );
-    }    
-    
+    }
+
     public void testBasicDeployWithPackagingAsPom()
         throws Exception
     {
-        File testPom = new File( getBasedir(),
-                        "target/test-classes/unit/basic-deploy-pom/plugin-config.xml" );
-        
-        mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
-        
+        File testPom = new File( getBasedir(), "target/test-classes/unit/basic-deploy-pom/plugin-config.xml" );
+
+        mojo = (DeployMojo) lookupMojo( "deploy", testPom );
+
         MockitoAnnotations.initMocks( this );
-        
+
         assertNotNull( mojo );
-        
-        ProjectBuildingRequest buildingRequest = mock ( ProjectBuildingRequest.class );
+
+        ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class );
         when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest );
         MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession();
         repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( LOCAL_REPO ) );
         when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession );
-        
-        File pomFile = new File( getBasedir(),
-                              "target/test-classes/unit/basic-deploy-pom/target/" +
-                              "deploy-test-file-1.0-SNAPSHOT.pom" );
+
+        File pomFile =
+            new File( getBasedir(),
+                      "target/test-classes/unit/basic-deploy-pom/target/" + "deploy-test-file-1.0-SNAPSHOT.pom" );
 
         assertTrue( pomFile.exists() );
-        
+
         MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" );
 
         setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) );
 
         artifact = (DeployArtifactStub) project.getArtifact();
-        
+
         artifact.setArtifactHandlerExtension( project.getPackaging() );
-        
-        artifact.setFile( pomFile );  
-        
+
+        artifact.setFile( pomFile );
+
         ArtifactRepositoryStub repo = getRepoStub( mojo );
-        
+
         repo.setAppendToUrl( "basic-deploy-pom" );
-        
+
         mojo.execute();
-        
+
         List<String> expectedFiles = new ArrayList<String>();
         List<String> fileList = new ArrayList<String>();
-        
+
         expectedFiles.add( "org" );
         expectedFiles.add( "apache" );
         expectedFiles.add( "maven" );
@@ -346,73 +347,73 @@ public class DeployMojoTest
         // as we are in SNAPSHOT the file is here twice
         expectedFiles.add( "maven-metadata.xml" );
         expectedFiles.add( "maven-metadata.xml.md5" );
-        expectedFiles.add( "maven-metadata.xml.sha1" ); 
+        expectedFiles.add( "maven-metadata.xml.sha1" );
         remoteRepo = new File( remoteRepo, "basic-deploy-pom" );
-        
+
         File[] files = remoteRepo.listFiles();
 
-        for (File file : files) {
-            addFileToList(file, fileList);
+        for ( File file : files )
+        {
+            addFileToList( file, fileList );
         }
-        
+
         assertEquals( expectedFiles.size(), fileList.size() );
 
-        assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );    
+        assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );
     }
 
     public void testDeployIfArtifactFileIsNull()
         throws Exception
     {
-        File testPom = new File( getBasedir(),
-                                 "target/test-classes/unit/basic-deploy-test/plugin-config.xml" );
-        
-        DeployMojo mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
+        File testPom = new File( getBasedir(), "target/test-classes/unit/basic-deploy-test/plugin-config.xml" );
+
+        DeployMojo mojo = (DeployMojo) lookupMojo( "deploy", testPom );
 
         MockitoAnnotations.initMocks( this );
 
-        ProjectBuildingRequest buildingRequest = mock ( ProjectBuildingRequest.class );
+        ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class );
         when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest );
-        
+
         setVariableValueToObject( mojo, "session", session );
-        
+
         assertNotNull( mojo );
-        
+
         MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" );
 
         setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) );
 
         artifact = (DeployArtifactStub) project.getArtifact();
-        
+
         artifact.setFile( null );
-        
+
         assertNull( artifact.getFile() );
-        
+
         try
         {
             mojo.execute();
 
             fail( "Did not throw mojo execution exception" );
         }
-        catch( MojoExecutionException e )
+        catch ( MojoExecutionException e )
         {
-            //expected
+            // expected
         }
     }
-    
+
     public void testDeployWithAttachedArtifacts()
         throws Exception
     {
-        File testPom = new File( getBasedir(),
-                                 "target/test-classes/unit/basic-deploy-with-attached-artifacts/" +
-                                 "plugin-config.xml" );
+        File testPom =
+            new File( getBasedir(),
+                      "target/test-classes/unit/basic-deploy-with-attached-artifacts/" + "plugin-config.xml" );
+
+        mojo = (DeployMojo) lookupMojo( "deploy", testPom );
 
-        mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
-        
         MockitoAnnotations.initMocks( this );
-        
+
         assertNotNull( mojo );
-        
-        ProjectBuildingRequest buildingRequest = mock ( ProjectBuildingRequest.class );
+
+        ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class );
         when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest );
         MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession();
         repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( LOCAL_REPO ) );
@@ -423,23 +424,22 @@ public class DeployMojoTest
         setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) );
 
         artifact = (DeployArtifactStub) project.getArtifact();
-        
-        File file = new File( getBasedir(),
-                              "target/test-classes/unit/basic-deploy-with-attached-artifacts/target/" +
-                              "deploy-test-file-1.0-SNAPSHOT.jar" );
-        
+
+        File file = new File( getBasedir(), "target/test-classes/unit/basic-deploy-with-attached-artifacts/target/"
+            + "deploy-test-file-1.0-SNAPSHOT.jar" );
+
         artifact.setFile( file );
-        
+
         ArtifactRepositoryStub repo = getRepoStub( mojo );
-        
-        repo.setAppendToUrl( "basic-deploy-with-attached-artifacts" );          
-        
+
+        repo.setAppendToUrl( "basic-deploy-with-attached-artifacts" );
+
         mojo.execute();
 
-        //check the artifacts in remote repository
+        // check the artifacts in remote repository
         List<String> expectedFiles = new ArrayList<String>();
         List<String> fileList = new ArrayList<String>();
-        
+
         expectedFiles.add( "org" );
         expectedFiles.add( "apache" );
         expectedFiles.add( "maven" );
@@ -458,7 +458,7 @@ public class DeployMojoTest
         // as we are in SNAPSHOT the file is here twice
         expectedFiles.add( "maven-metadata.xml" );
         expectedFiles.add( "maven-metadata.xml.md5" );
-        expectedFiles.add( "maven-metadata.xml.sha1" );         
+        expectedFiles.add( "maven-metadata.xml.sha1" );
         expectedFiles.add( "attached-artifact-test-0" );
         expectedFiles.add( "1.0-SNAPSHOT" );
         expectedFiles.add( "maven-metadata.xml" );
@@ -470,105 +470,102 @@ public class DeployMojoTest
         // as we are in SNAPSHOT the file is here twice
         expectedFiles.add( "maven-metadata.xml" );
         expectedFiles.add( "maven-metadata.xml.md5" );
-        expectedFiles.add( "maven-metadata.xml.sha1" );         
-        
+        expectedFiles.add( "maven-metadata.xml.sha1" );
+
         remoteRepo = new File( remoteRepo, "basic-deploy-with-attached-artifacts" );
-        
+
         File[] files = remoteRepo.listFiles();
 
-        for (File file1 : files) {
-            addFileToList(file1, fileList);
+        for ( File file1 : files )
+        {
+            addFileToList( file1, fileList );
         }
-        
+
         assertEquals( expectedFiles.size(), fileList.size() );
 
-        assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );               
+        assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );
     }
-    
+
     @Ignore( "SCP is not part of Maven3 distribution. Aether handles transport extensions." )
     public void _testBasicDeployWithScpAsProtocol()
         throws Exception
     {
         String originalUserHome = System.getProperty( "user.home" );
-        
+
         // FIX THE DAMN user.home BEFORE YOU DELETE IT!!!
         File altHome = new File( getBasedir(), "target/ssh-user-home" );
         altHome.mkdirs();
-        
+
         System.out.println( "Testing user.home value for .ssh dir: " + altHome.getCanonicalPath() );
-        
+
         Properties props = System.getProperties();
         props.setProperty( "user.home", altHome.getCanonicalPath() );
-        
+
         System.setProperties( props );
-        
-        File testPom = new File( getBasedir(),
-                                 "target/test-classes/unit/basic-deploy-scp/plugin-config.xml" );
-        
-        mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
-        
+
+        File testPom = new File( getBasedir(), "target/test-classes/unit/basic-deploy-scp/plugin-config.xml" );
+
+        mojo = (DeployMojo) lookupMojo( "deploy", testPom );
+
         assertNotNull( mojo );
-        
+
         ArtifactDeployerStub deployer = new ArtifactDeployerStub();
-        
+
         setVariableValueToObject( mojo, "deployer", deployer );
-        
-        File file = new File( getBasedir(),
-                              "target/test-classes/unit/basic-deploy-scp/target/" +
-                              "deploy-test-file-1.0-SNAPSHOT.jar" );
+
+        File file =
+            new File( getBasedir(),
+                      "target/test-classes/unit/basic-deploy-scp/target/" + "deploy-test-file-1.0-SNAPSHOT.jar" );
 
         assertTrue( file.exists() );
-        
+
         MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" );
 
         setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) );
 
         artifact = (DeployArtifactStub) project.getArtifact();
-        
+
         artifact.setFile( file );
-        
+
         String altUserHome = System.getProperty( "user.home" );
-        
+
         if ( altUserHome.equals( originalUserHome ) )
         {
             // this is *very* bad!
             throw new IllegalStateException( "Setting 'user.home' system property to alternate value did NOT work. Aborting test." );
         }
-        
+
         File sshFile = new File( altUserHome, ".ssh" );
-        
+
         System.out.println( "Testing .ssh dir: " + sshFile.getCanonicalPath() );
-        
-        //delete first the .ssh folder if existing before executing the mojo
-        if( sshFile.exists() )
+
+        // delete first the .ssh folder if existing before executing the mojo
+        if ( sshFile.exists() )
         {
             FileUtils.deleteDirectory( sshFile );
         }
 
         mojo.execute();
-            
+
         assertTrue( sshFile.exists() );
-        
+
         FileUtils.deleteDirectory( sshFile );
     }
-    
+
     public void testAltSnapshotDeploymentRepository()
         throws Exception
     {
         DeployMojo mojo = spy( new DeployMojo() );
 
         ArtifactRepository repository = mock( ArtifactRepository.class );
-        when( mojo.createDeploymentArtifactRepository( "altSnapshotDeploymentRepository", "http://localhost"
-                                                       ) ).thenReturn( repository );
+        when( mojo.createDeploymentArtifactRepository( "altSnapshotDeploymentRepository",
+                                                       "http://localhost" ) ).thenReturn( repository );
 
         project.setVersion( "1.0-SNAPSHOT" );
 
         ProjectDeployerRequest pdr =
-                        new ProjectDeployerRequest()
-                            .setProject( project )
-                            .setAltDeploymentRepository( "altSnapshotDeploymentRepository::http://localhost" );
-        assertEquals( repository,
-                      mojo.getDeploymentRepository( pdr ));
+            new ProjectDeployerRequest().setProject( project ).setAltDeploymentRepository( "altSnapshotDeploymentRepository::http://localhost" );
+        assertEquals( repository, mojo.getDeploymentRepository( pdr ) );
     }
 
     public void testAltReleaseDeploymentRepository()
@@ -577,22 +574,86 @@ public class DeployMojoTest
         DeployMojo mojo = spy( new DeployMojo() );
 
         ArtifactRepository repository = mock( ArtifactRepository.class );
-        when( mojo.createDeploymentArtifactRepository( "altReleaseDeploymentRepository", "http://localhost" ) ).thenReturn( repository );
+        when( mojo.createDeploymentArtifactRepository( "altReleaseDeploymentRepository",
+                                                       "http://localhost" ) ).thenReturn( repository );
 
         project.setVersion( "1.0" );
 
         ProjectDeployerRequest pdr =
-                        new ProjectDeployerRequest()
-                            .setProject( project )
-                            .setAltReleaseDeploymentRepository( "altReleaseDeploymentRepository::http://localhost" );
+            new ProjectDeployerRequest().setProject( project ).setAltReleaseDeploymentRepository( "altReleaseDeploymentRepository::http://localhost" );
 
-        assertEquals( repository,
-                      mojo.getDeploymentRepository( pdr ));
+        assertEquals( repository, mojo.getDeploymentRepository( pdr ) );
     }
-    
+
+    public void testOldRepositoryformatForAltReleaseDeploymentRepository()
+        throws MojoExecutionException, MojoFailureException, IllegalAccessException
+    {
+        DeployMojo mojo = spy( new DeployMojo() );
+
+        String altReleaseDeploymentRepository = "altReleaseDeploymentRepository::layout::http://localhost";
+
+        setVariableValueToObject( mojo, "altReleaseDeploymentRepository", altReleaseDeploymentRepository );
+        setVariableValueToObject( mojo, "altDeploymentRepository", null );
+        setVariableValueToObject( mojo, "altSnapshotDeploymentRepository", null );
+
+        try
+        {
+            mojo.execute();
+            fail( "We have expected an MojoFailureException" );
+        }
+        catch ( MojoFailureException e )
+        {
+            // Intentionally empty.
+        }
+    }
+
+    public void testOldRepositoryformatForAltDeploymentRepository()
+        throws MojoExecutionException, MojoFailureException, IllegalAccessException
+    {
+        DeployMojo mojo = spy( new DeployMojo() );
+
+        String altDeploymentRepository = "altDeploymentRepository::layout::http://localhost";
+
+        setVariableValueToObject( mojo, "altReleaseDeploymentRepository", null );
+        setVariableValueToObject( mojo, "altDeploymentRepository", altDeploymentRepository );
+        setVariableValueToObject( mojo, "altSnapshotDeploymentRepository", null );
+
+        try
+        {
+            mojo.execute();
+            fail( "We have expected an MojoFailureException" );
+        }
+        catch ( MojoFailureException e )
+        {
+            // Intentionally empty.
+        }
+    }
+
+    public void testOldRepositoryformatForAltSnapshotDeploymentRepository()
+        throws MojoExecutionException, MojoFailureException, IllegalAccessException
+    {
+        DeployMojo mojo = spy( new DeployMojo() );
+
+        String altSnapshotDeploymentRepository = "altSnapshotDeploymentRepository::layout::http://localhost";
+
+        setVariableValueToObject( mojo, "altReleaseDeploymentRepository", null );
+        setVariableValueToObject( mojo, "altDeploymentRepository", null );
+        setVariableValueToObject( mojo, "altSnapshotDeploymentRepository", altSnapshotDeploymentRepository );
+
+        try
+        {
+            mojo.execute();
+            fail( "We have expected an MojoFailureException" );
+        }
+        catch ( MojoFailureException e )
+        {
+            // Intentionally empty.
+        }
+    }
+
     private void addFileToList( File file, List<String> fileList )
     {
-        if( !file.isDirectory() )
+        if ( !file.isDirectory() )
         {
             fileList.add( file.getName() );
         }
@@ -602,26 +663,27 @@ public class DeployMojoTest
 
             File[] files = file.listFiles();
 
-            for (File file1 : files) {
-                addFileToList(file1, fileList);
+            for ( File file1 : files )
+            {
+                addFileToList( file1, fileList );
             }
         }
-    }    
-    
+    }
+
     private int getSizeOfExpectedFiles( List<String> fileList, List<String> expectedFiles )
     {
-        for( String fileName : fileList )
+        for ( String fileName : fileList )
         {
-            // translate uniqueVersion to -SNAPSHOT 
+            // translate uniqueVersion to -SNAPSHOT
             fileName = fileName.replaceFirst( "-\\d{8}\\.\\d{6}-\\d+", "-SNAPSHOT" );
-            
-            if( !expectedFiles.remove( fileName ) )
+
+            if ( !expectedFiles.remove( fileName ) )
             {
                 fail( fileName + " is not included in the expected files" );
             }
         }
         return expectedFiles.size();
-    }    
+    }
 
     private ArtifactRepositoryStub getRepoStub( Object mojo )
         throws Exception