From 6c23c73b8d3262a63dc863af9151a1ca3b91dd6d Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Tue, 8 Mar 2005 18:35:00 +0000 Subject: [PATCH] error handling on pom:deploy git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163497 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/plugin/pom/PomDeployMojo.java | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomDeployMojo.java b/maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomDeployMojo.java index 0262b74f74..421befad8a 100644 --- a/maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomDeployMojo.java +++ b/maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomDeployMojo.java @@ -30,24 +30,19 @@ import java.io.File; /** * @goal deploy - * * @description deploys a pom to remote repository - * - * @parameter - * name="project" - * type="org.apache.maven.project.MavenProject" - * required="true" - * validator="" - * expression="#project" - * description="" - * - * @parameter - * name="deployer" - * type="org.apache.maven.artifact.deployer.ArtifactDeployer" - * required="true" - * validator="" - * expression="#component.org.apache.maven.artifact.deployer.ArtifactDeployer" - * description="" + * @parameter name="project" + * type="org.apache.maven.project.MavenProject" + * required="true" + * validator="" + * expression="#project" + * description="" + * @parameter name="deployer" + * type="org.apache.maven.artifact.deployer.ArtifactDeployer" + * required="true" + * validator="" + * expression="#component.org.apache.maven.artifact.deployer.ArtifactDeployer" + * description="" */ public class PomDeployMojo extends AbstractPlugin @@ -59,12 +54,17 @@ public class PomDeployMojo ArtifactDeployer artifactDeployer = (ArtifactDeployer) request.getParameter( "deployer" ); - ArtifactRepository deploymentRepository = - RepositoryUtils.mavenRepositoryToWagonRepository( project.getDistributionManagement().getRepository() ); + // TODO: validation instead + if ( project.getDistributionManagement() == null ) + { + // TODO: simple failure response + throw new Exception( "distributionManagement is required for deployment" ); + } - Artifact artifact = new DefaultArtifact( project.getGroupId(), - project.getArtifactId(), - project.getVersion(), + ArtifactRepository deploymentRepository = RepositoryUtils.mavenRepositoryToWagonRepository( + project.getDistributionManagement().getRepository() ); + + Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(), "pom" ); File pom = new File( project.getFile().getParentFile(), "pom.xml" );