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 2017/04/16 11:21:00 UTC
svn commit: r1791602 - in /maven/plugins/trunk/maven-deploy-plugin/src:
main/java/org/apache/maven/plugins/deploy/
test/java/org/apache/maven/plugins/deploy/
Author: khmarbaise
Date: Sun Apr 16 11:20:59 2017
New Revision: 1791602
URL: http://svn.apache.org/viewvc?rev=1791602&view=rev
Log:
[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.
Modified:
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java
maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
Modified: maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java?rev=1791602&r1=1791601&r2=1791602&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java Sun Apr 16 11:20:59 2017
@@ -19,17 +19,13 @@ package org.apache.maven.plugins.deploy;
* 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 @@ public abstract class AbstractDeployMojo
{
/**
- * 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 @@ public abstract class AbstractDeployMojo
}
}
- 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 @@ public abstract class AbstractDeployMojo
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() );
}
Modified: maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java?rev=1791602&r1=1791601&r2=1791602&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java Sun Apr 16 11:20:59 2017
@@ -36,7 +36,6 @@ import java.util.regex.Pattern;
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 @@ public class DeployFileMojo
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 @@ public class DeployFileMojo
initProperties();
- ArtifactRepositoryLayout layout = getLayout( repositoryLayout );
-
- ArtifactRepository deploymentRepository = createDeploymentArtifactRepository( repositoryId, url, layout );
+ ArtifactRepository deploymentRepository = createDeploymentArtifactRepository( repositoryId, url );
String protocol = deploymentRepository.getProtocol();
Modified: maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java?rev=1791602&r1=1791601&r2=1791602&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java Sun Apr 16 11:20:59 2017
@@ -30,7 +30,6 @@ import java.util.regex.Pattern;
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 @@ public class DeployMojo
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 @@ public class DeployMojo
* <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 @@ public class DeployMojo
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 );
}
}
Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java?rev=1791602&r1=1791601&r2=1791602&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java Sun Apr 16 11:20:59 2017
@@ -267,31 +267,31 @@ public class DeployFileMojoTest
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() )
Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java?rev=1791602&r1=1791601&r2=1791602&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java Sun Apr 16 11:20:59 2017
@@ -30,7 +30,6 @@ import java.util.List;
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 @@ public class DeployMojoTest
{
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 @@ public class DeployMojoTest
{
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 ));