error handling on pom:deploy

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163497 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-03-08 18:35:00 +00:00
parent e8a0f65e58
commit 6c23c73b8d
1 changed files with 22 additions and 22 deletions

View File

@ -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" );