maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: maven-components/maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom PomDeployMojo.java
Date Wed, 16 Mar 2005 01:19:19 GMT
brett       2005/03/15 17:19:19

  Modified:    maven-plugins/maven-pom-plugin pom.xml
               maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom
                        PomDeployMojo.java
  Log:
  updated to match deploy plugin, until it can be removed
  
  Revision  Changes    Path
  1.7       +5 -0      maven-components/maven-plugins/maven-pom-plugin/pom.xml
  
  Index: pom.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-pom-plugin/pom.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- pom.xml	15 Mar 2005 22:31:54 -0000	1.6
  +++ pom.xml	16 Mar 2005 01:19:19 -0000	1.7
  @@ -26,6 +26,11 @@
       </dependency>
       <dependency>
         <groupId>maven</groupId>
  +      <artifactId>maven-user-model</artifactId>
  +      <version>2.0-SNAPSHOT</version>
  +    </dependency>
  +    <dependency>
  +      <groupId>maven</groupId>
         <artifactId>maven-model</artifactId>
         <version>2.0-SNAPSHOT</version>
         <type>jar</type>
  
  
  
  1.6       +34 -10    maven-components/maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomDeployMojo.java
  
  Index: PomDeployMojo.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomDeployMojo.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PomDeployMojo.java	9 Mar 2005 05:48:31 -0000	1.5
  +++ PomDeployMojo.java	16 Mar 2005 01:19:19 -0000	1.6
  @@ -20,7 +20,9 @@
   import org.apache.maven.artifact.DefaultArtifact;
   import org.apache.maven.artifact.deployer.ArtifactDeployer;
   import org.apache.maven.artifact.repository.ArtifactRepository;
  +import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
   import org.apache.maven.model.Repository;
  +import org.apache.maven.model.user.UserModel;
   import org.apache.maven.plugin.AbstractPlugin;
   import org.apache.maven.plugin.PluginExecutionRequest;
   import org.apache.maven.plugin.PluginExecutionResponse;
  @@ -32,12 +34,12 @@
    * @goal deploy
    * @description deploys a pom to remote repository
    * @parameter name="project" type="org.apache.maven.project.MavenProject"
  - *            required="true" validator="" expression="#project" description=""
  + * 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=""
  + * 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"
  @@ -50,6 +52,18 @@
    * validator=""
    * expression="#component.org.apache.maven.artifact.deployer.ArtifactDeployer"
    * description=""
  + * @parameter name="artifactRepositoryFactory"
  + * type="org.apache.maven.artifact.repository.ArtifactRepositoryFactory"
  + * required="true"
  + * validator=""
  + * expression="#component.org.apache.maven.artifact.repository.ArtifactRepositoryFactory"
  + * description=""
  + * @parameter name="userModel"
  + * type="org.apache.maven.model.user.UserModel"
  + * required="true"
  + * validator=""
  + * expression="#userModel"
  + * description=""
    */
   public class PomDeployMojo
       extends AbstractPlugin
  @@ -61,18 +75,28 @@
   
           ArtifactDeployer artifactDeployer = (ArtifactDeployer) request.getParameter( "deployer"
);
   
  +        ArtifactRepositoryFactory artifactRepositoryFactory = (ArtifactRepositoryFactory)
request.getParameter(
  +            "artifactRepositoryFactory" );
  +
  +        UserModel userModel = (UserModel) request.getParameter( "userModel" );
  +
           // TODO: validation instead
           if ( project.getDistributionManagement() == null )
           {
               // TODO: simple failure response
               throw new Exception( "distributionManagement is required for deployment" );
           }
  -        Repository repo = project.getDistributionManagement().getRepository();
  -        ArtifactRepository deploymentRepository = new ArtifactRepository( repo.getId(),
repo.getUrl() );
  +        Repository repository = project.getDistributionManagement().getRepository();
  +        ArtifactRepository deploymentRepository = artifactRepositoryFactory.createArtifactRepository(
repository,
  +                                                                                      
               userModel );
  +
  +        if ( deploymentRepository.getAuthenticationInfo() == null )
  +        {
  +            request.getLog().warn(
  +                "Deployment repository {id: \'" + repository.getId() + "\'} has no associated
authentication info!" );
  +        }
   
  -        Artifact artifact = new DefaultArtifact( project.getGroupId(),
  -                                                 project.getArtifactId(),
  -                                                 project.getVersion(),
  +        Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(),
project.getVersion(),
                                                    "pom" );
   
           File pom = new File( project.getFile().getParentFile(), "pom.xml" );
  
  
  

Mime
View raw message