[MDEPLOY-207] Remove @Deprecated marked code
o Removed the repositoryLayout parameter of deploy-file goal
and the configuration part layout in altDeploymentRepository
cause we are in Maven 3 and not Maven 2 and before anymore.
git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1791602 13f79535-47bb-0310-9956-ffa450edef68
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 504806e..77e811f 100644
--- a/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java
+++ b/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java
@@ -19,17 +19,13 @@
* under the License.
*/
-import java.util.Map;
-
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.MavenArtifactRepository;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
/**
@@ -40,12 +36,6 @@
{
/**
- * Map that contains the layouts.
- */
- @Component( role = ArtifactRepositoryLayout.class )
- private Map<String, ArtifactRepositoryLayout> repositoryLayouts;
-
- /**
* Flag whether Maven is currently in online/offline mode.
*/
@Parameter( defaultValue = "${settings.offline}", readonly = true )
@@ -80,19 +70,6 @@
}
}
- ArtifactRepositoryLayout getLayout( String id )
- throws MojoExecutionException
- {
- ArtifactRepositoryLayout layout = repositoryLayouts.get( id );
-
- if ( layout == null )
- {
- throw new MojoExecutionException( "Invalid repository layout: " + id );
- }
-
- return layout;
- }
-
boolean isUpdateReleaseInfo()
{
return updateReleaseInfo;
@@ -103,10 +80,9 @@
return retryFailedDeploymentCount;
}
- protected ArtifactRepository createDeploymentArtifactRepository( String id, String url,
- ArtifactRepositoryLayout layout )
+ protected ArtifactRepository createDeploymentArtifactRepository( String id, String url )
{
- return new MavenArtifactRepository( id, url, layout, new ArtifactRepositoryPolicy(),
+ return new MavenArtifactRepository( id, url, new DefaultRepositoryLayout(), new ArtifactRepositoryPolicy(),
new ArtifactRepositoryPolicy() );
}
diff --git a/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java b/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
index 1c493d3..140e589 100644
--- a/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
+++ b/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
@@ -36,7 +36,6 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.model.Model;
import org.apache.maven.model.Parent;
import org.apache.maven.model.building.ModelBuildingException;
@@ -155,13 +154,6 @@
private String repositoryId;
/**
- * The type of remote repository layout to deploy to. Try <i>legacy</i> for a Maven 1.x-style repository layout.
- */
- @Deprecated
- @Parameter( property = "repositoryLayout", defaultValue = "default" )
- private String repositoryLayout;
-
- /**
* URL where the artifact will be deployed. <br/>
* ie ( file:///C:/m2-repo or scp://host.com/path/to/repo )
*/
@@ -341,9 +333,7 @@
initProperties();
- ArtifactRepositoryLayout layout = getLayout( repositoryLayout );
-
- ArtifactRepository deploymentRepository = createDeploymentArtifactRepository( repositoryId, url, layout );
+ ArtifactRepository deploymentRepository = createDeploymentArtifactRepository( repositoryId, url );
String protocol = deploymentRepository.getProtocol();
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 b626d31..11dca7c 100644
--- a/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
+++ b/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
@@ -30,7 +30,6 @@
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
@@ -55,7 +54,7 @@
extends AbstractDeployMojo
{
- private static final Pattern ALT_REPO_SYNTAX_PATTERN = Pattern.compile( "(.+)::(.+)::(.+)" );
+ private static final Pattern 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
@@ -91,12 +90,10 @@
* <dl>
* <dt>id</dt>
* <dd>The id can be used to pick up the correct credentials from the settings.xml</dd>
- * <dt>layout</dt>
- * <dd>Either <code>default</code> for the Maven2 layout or <code>legacy</code> for the Maven1 layout. Maven3 also
- * uses the <code>default</code> layout.</dd>
* <dt>url</dt>
* <dd>The location of the repository</dd>
* </dl>
+ * <b>Note: Since 3.0.0 the layout part has been removed.</b>
*/
@Parameter( property = "altDeploymentRepository" )
private String altDeploymentRepository;
@@ -247,12 +244,9 @@
else
{
String id = matcher.group( 1 ).trim();
- String layout = matcher.group( 2 ).trim();
- String url = matcher.group( 3 ).trim();
+ String url = matcher.group( 2 ).trim();
- ArtifactRepositoryLayout repoLayout = getLayout( layout );
-
- repo = createDeploymentArtifactRepository( id, url, repoLayout );
+ repo = createDeploymentArtifactRepository( id, url );
}
}
diff --git a/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java b/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java
index fff8676..2ebd83c 100644
--- a/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java
@@ -267,31 +267,31 @@
assertTrue( file.exists() );
}
- public void testDeployIfRepositoryLayoutIsLegacy()
- throws Exception
- {
- File testPom = new File( getBasedir(), "target/test-classes/unit/deploy-file-legacy-repository-layout/plugin-config.xml" );
-
- AbstractDeployMojo mojo = (AbstractDeployMojo) lookupMojo( "deploy-file", testPom );
-
- assertNotNull( mojo );
-
- String repositoryLayout = (String) getVariableValueFromObject( mojo, "repositoryLayout" );
-
- assertEquals( "legacy", repositoryLayout );
-
- try
- {
- mojo.execute();
- fail( "legacy is not supported anymore" );
- }
- catch ( MojoExecutionException e )
- {
- assertEquals( "Invalid repository layout: legacy", e.getMessage() );
- }
-
- }
-
+// public void testDeployIfRepositoryLayoutIsLegacy()
+// throws Exception
+// {
+// File testPom = new File( getBasedir(), "target/test-classes/unit/deploy-file-legacy-repository-layout/plugin-config.xml" );
+//
+// AbstractDeployMojo mojo = (AbstractDeployMojo) lookupMojo( "deploy-file", testPom );
+//
+// assertNotNull( mojo );
+//
+// String repositoryLayout = (String) getVariableValueFromObject( mojo, "repositoryLayout" );
+//
+// assertEquals( "legacy", repositoryLayout );
+//
+// try
+// {
+// mojo.execute();
+// fail( "legacy is not supported anymore" );
+// }
+// catch ( MojoExecutionException e )
+// {
+// assertEquals( "Invalid repository layout: legacy", e.getMessage() );
+// }
+//
+// }
+//
private void addFileToList( File file, List<String> fileList )
{
if ( !file.isDirectory() )
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 e88bfb5..4db5b2d 100644
--- a/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
@@ -30,7 +30,6 @@
import java.util.Properties;
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
@@ -596,19 +595,16 @@
{
DeployMojo mojo = spy( new DeployMojo() );
- ArtifactRepositoryLayout repositoryLayout = mock( ArtifactRepositoryLayout.class );
- setVariableValueToObject( mojo, "repositoryLayouts", Collections.singletonMap( "default", repositoryLayout ) );
-
ArtifactRepository repository = mock( ArtifactRepository.class );
- when( mojo.createDeploymentArtifactRepository( "altSnapshotDeploymentRepository", "http://localhost",
- repositoryLayout ) ).thenReturn( repository );
+ when( mojo.createDeploymentArtifactRepository( "altSnapshotDeploymentRepository", "http://localhost"
+ ) ).thenReturn( repository );
project.setVersion( "1.0-SNAPSHOT" );
ProjectDeployerRequest pdr =
new ProjectDeployerRequest()
.setProject( project )
- .setAltDeploymentRepository( "altSnapshotDeploymentRepository::default::http://localhost" );
+ .setAltDeploymentRepository( "altSnapshotDeploymentRepository::http://localhost" );
assertEquals( repository,
mojo.getDeploymentRepository( pdr ));
}
@@ -618,19 +614,15 @@
{
DeployMojo mojo = spy( new DeployMojo() );
- ArtifactRepositoryLayout repositoryLayout = mock( ArtifactRepositoryLayout.class );
- setVariableValueToObject( mojo, "repositoryLayouts", Collections.singletonMap( "default", repositoryLayout ) );
-
ArtifactRepository repository = mock( ArtifactRepository.class );
- when( mojo.createDeploymentArtifactRepository( "altReleaseDeploymentRepository", "http://localhost",
- repositoryLayout ) ).thenReturn( repository );
+ when( mojo.createDeploymentArtifactRepository( "altReleaseDeploymentRepository", "http://localhost" ) ).thenReturn( repository );
project.setVersion( "1.0" );
ProjectDeployerRequest pdr =
new ProjectDeployerRequest()
.setProject( project )
- .setAltReleaseDeploymentRepository( "altReleaseDeploymentRepository::default::http://localhost" );
+ .setAltReleaseDeploymentRepository( "altReleaseDeploymentRepository::http://localhost" );
assertEquals( repository,
mojo.getDeploymentRepository( pdr ));