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-model maven.mdo
Date Thu, 03 Feb 2005 11:39:27 GMT
brett       2005/02/03 03:39:27

  Modified:    maven-core/src/main/java/org/apache/maven/cli MavenCli.java
               maven-core/src/main/java/org/apache/maven/execution/initialize
                        MavenInitializingExecutionRequest.java
               maven-core/src/main/java/org/apache/maven/execution/project
                        MavenProjectExecutionRequest.java
               maven-core/src/main/java/org/apache/maven/execution/reactor
                        MavenReactorExecutionRequest.java
                        MavenReactorExecutionRequestHandler.java
               maven-core/src/main/java/org/apache/maven/execution
                        AbstractMavenExecutionRequest.java
                        MavenExecutionRequest.java
                        MavenSetupExecutionRequest.java
               maven-core/src/main/java/org/apache/maven/project
                        ProjectDefaultsInjector.java
               maven-core/src/main/java/org/apache/maven/repository
                        RepositoryUtils.java
               maven-model maven.mdo
  Log:
  o add basic auth to model and lightweight wagon
  o add proxy configuration in lightweight wagon
  o not yet wiring in the properties from maven.properties into the repository
  
  Revision  Changes    Path
  1.7       +14 -57    maven-components/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
  
  Index: MavenCli.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MavenCli.java	25 Dec 2004 16:26:24 -0000	1.6
  +++ MavenCli.java	3 Feb 2005 11:39:24 -0000	1.7
  @@ -47,20 +47,17 @@
   public class MavenCli
   {
       public static final String POMv4 = "pom.xml";
  -
       public static final String userHome = System.getProperty( "user.home" );
  -
       public static File userDir = new File( System.getProperty( "user.dir" ) );
   
       public static int main( String[] args, ClassWorld classWorld )
  -        throws Exception
  +    throws Exception
       {
           // ----------------------------------------------------------------------
           // Setup the command line parser
           // ----------------------------------------------------------------------
   
           CLIManager cliManager = new CLIManager();
  -
           CommandLine commandLine = cliManager.parse( args );
   
           // ----------------------------------------------------------------------
  @@ -72,9 +69,7 @@
           // ----------------------------------------------------------------------
   
           File userConfigurationDirectory = getUserConfigurationDirectory();
  -
           Properties mavenProperties = getMavenProperties( userConfigurationDirectory );
  -
           ArtifactRepository localRepository = getLocalRepository( mavenProperties, userConfigurationDirectory
);
   
           // ----------------------------------------------------------------------
  @@ -90,14 +85,11 @@
           if ( commandLine.hasOption( CLIManager.HELP ) )
           {
               cliManager.displayHelp();
  -
               return 0;
           }
  -
           if ( commandLine.hasOption( CLIManager.VERSION ) )
           {
               System.out.println( "Maven version: " );
  -
               return 0;
           }
   
  @@ -108,29 +100,27 @@
           // ----------------------------------------------------------------------
   
           MavenExecutionRequest request = null;
  -
           File projectFile = new File( userDir, POMv4 );
  -
           if ( projectFile.exists() )
           {
               if ( commandLine.hasOption( CLIManager.REACTOR ) )
               {
                   String includes = System.getProperty( "maven.reactor.includes", "**/" +
POMv4 );
  -
                   String excludes = System.getProperty( "maven.reactor.excludes", POMv4 );
  -
  -                request = new MavenReactorExecutionRequest( localRepository, commandLine.getArgList(),
includes, excludes, userDir );
  +                request = new MavenReactorExecutionRequest( localRepository, mavenProperties,
commandLine.getArgList(),
  +                                                            includes, excludes, userDir
);
               }
               else
               {
  -                request = new MavenProjectExecutionRequest( localRepository, commandLine.getArgList(),
projectFile );
  +                request = new MavenProjectExecutionRequest( localRepository, mavenProperties,
commandLine.getArgList(),
  +                                                            projectFile );
               }
           }
           else
           {
  -            request = new MavenInitializingExecutionRequest( localRepository, commandLine.getArgList()
);
  +            request = new MavenInitializingExecutionRequest( localRepository, mavenProperties,
  +                                                             commandLine.getArgList() );
           }
  -
           MavenExecutionResponse response = new MavenExecutionResponse();
   
           // ----------------------------------------------------------------------
  @@ -139,9 +129,7 @@
           // ----------------------------------------------------------------------
   
           ArtifactEnabledEmbedder embedder = new ArtifactEnabledEmbedder();
  -
           embedder.start( classWorld );
  -
           Maven maven = (Maven) embedder.lookup( Maven.ROLE );
   
           // ----------------------------------------------------------------------
  @@ -149,7 +137,6 @@
           // ----------------------------------------------------------------------
   
           response = maven.execute( request );
  -
           if ( response.isExecutionFailure() )
           {
               return 1;
  @@ -175,7 +162,6 @@
           if ( commandLine.hasOption( CLIManager.SET_SYSTEM_PROPERTY ) )
           {
               String[] defStrs = commandLine.getOptionValues( CLIManager.SET_SYSTEM_PROPERTY
);
  -
               for ( int i = 0; i < defStrs.length; ++i )
               {
                   setCliProperty( defStrs[i] );
  @@ -186,24 +172,18 @@
       private static void setCliProperty( String property )
       {
           String name = null;
  -
           String value = null;
  -
           int i = property.indexOf( "=" );
  -
           if ( i <= 0 )
           {
               name = property.trim();
  -
               value = "true";
           }
           else
           {
               name = property.substring( 0, i ).trim();
  -
               value = property.substring( i + 1 ).trim();
           }
  -
           System.setProperty( name, value );
       }
   
  @@ -214,86 +194,68 @@
       static class CLIManager
       {
           public static final char NO_BANNER = 'b';
  -
           public static final char SET_SYSTEM_PROPERTY = 'D';
  -
           public static final char WORK_OFFLINE = 'o';
  -
           public static final char REACTOR = 'r';
  -
           public static final char DEBUG = 'X';
  -
           public static final char HELP = 'h';
  -
           public static final char VERSION = 'v';
  -
           public static final char LIST_GOALS = 'g';
  -
           private Options options = null;
   
           public CLIManager()
           {
               options = new Options();
  -
               options.addOption( OptionBuilder
                                  .withLongOpt( "nobanner" )
                                  .withDescription( "Suppress logo banner" )
                                  .create( NO_BANNER ) );
  -
               options.addOption( OptionBuilder
                                  .withLongOpt( "define" )
                                  .hasArg()
                                  .withDescription( "Define a system property" )
                                  .create( SET_SYSTEM_PROPERTY ) );
  -
               options.addOption( OptionBuilder
                                  .withLongOpt( "offline" )
                                  .hasArg()
                                  .withDescription( "Work offline" )
                                  .create( WORK_OFFLINE ) );
  -
               options.addOption( OptionBuilder
                                  .withLongOpt( "mojoDescriptors" )
                                  .withDescription( "Display available mojoDescriptors" )
                                  .create( LIST_GOALS ) );
  -
               options.addOption( OptionBuilder
                                  .withLongOpt( "help" )
                                  .withDescription( "Display help information" )
                                  .create( HELP ) );
  -
               options.addOption( OptionBuilder
                                  .withLongOpt( "offline" )
                                  .withDescription( "Build is happening offline" )
                                  .create( WORK_OFFLINE ) );
  -
               options.addOption( OptionBuilder
                                  .withLongOpt( "version" )
                                  .withDescription( "Display version information" )
                                  .create( VERSION ) );
  -
               options.addOption( OptionBuilder
                                  .withLongOpt( "debug" )
                                  .withDescription( "Produce execution debug output" )
                                  .create( DEBUG ) );
  -
               options.addOption( OptionBuilder
                                  .withLongOpt( "reactor" )
                                  .withDescription( "Execute goals for project found in the
reactor" )
                                  .create( REACTOR ) );
           }
   
  -        public CommandLine parse( String[] args ) throws ParseException
  +        public CommandLine parse( String[] args )
  +        throws ParseException
           {
               CommandLineParser parser = new PosixParser();
  -
               return parser.parse( options, args );
           }
   
           public void displayHelp()
           {
               HelpFormatter formatter = new HelpFormatter();
  -
               formatter.printHelp( "maven [options] [goal [goal2 [goal3] ...]]", "\nOptions:",
options, "\n" );
           }
       }
  @@ -305,7 +267,6 @@
       protected static File getUserConfigurationDirectory()
       {
           File mavenUserConfigurationDirectory = new File( userHome, MavenConstants.MAVEN_USER_CONFIGURATION_DIRECTORY
);
  -
           if ( !mavenUserConfigurationDirectory.exists() )
           {
               if ( !mavenUserConfigurationDirectory.mkdirs() )
  @@ -313,39 +274,35 @@
                   //throw a configuration exception
               }
           }
  -
           return mavenUserConfigurationDirectory;
       }
   
       protected static Properties getMavenProperties( File mavenHomeLocal )
       {
           Properties mavenProperties = new Properties();
  -
           File mavenPropertiesFile = new File( mavenHomeLocal, MavenConstants.MAVEN_PROPERTIES
);
  -
           try
  -        {
  +              {
               mavenProperties.load( new FileInputStream( mavenPropertiesFile ) );
           }
           catch ( Exception e )
           {
               // do nothing
           }
  -
           return mavenProperties;
       }
   
  -    protected static ArtifactRepository getLocalRepository( Properties mavenProperties,
File userConfigurationDirectory )
  +    protected static ArtifactRepository getLocalRepository( Properties mavenProperties,
  +                                                            File userConfigurationDirectory
)
       {
           String localRepository = mavenProperties.getProperty( MavenConstants.MAVEN_REPO_LOCAL
);
  -
           if ( localRepository == null )
           {
               localRepository = new File( userConfigurationDirectory, MavenConstants.MAVEN_REPOSITORY
).getAbsolutePath();
           }
   
  +        // TODO [BP]: this should not be necessary - grep for and remove
           System.setProperty( MavenConstants.MAVEN_REPO_LOCAL, localRepository );
  -
           return RepositoryUtils.localRepositoryToWagonRepository( localRepository );
       }
   }
  
  
  
  1.3       +6 -6      maven-components/maven-core/src/main/java/org/apache/maven/execution/initialize/MavenInitializingExecutionRequest.java
  
  Index: MavenInitializingExecutionRequest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/initialize/MavenInitializingExecutionRequest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MavenInitializingExecutionRequest.java	25 Dec 2004 16:26:24 -0000	1.2
  +++ MavenInitializingExecutionRequest.java	3 Feb 2005 11:39:24 -0000	1.3
  @@ -21,18 +21,18 @@
   import org.apache.maven.execution.AbstractMavenExecutionRequest;
   
   import java.util.List;
  +import java.util.Properties;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
    * @version $Id$
    */
   public class MavenInitializingExecutionRequest
  -    extends AbstractMavenExecutionRequest
  +extends AbstractMavenExecutionRequest
   {
  -    public MavenInitializingExecutionRequest( ArtifactRepository localRepository, List
goals )
  +    public MavenInitializingExecutionRequest( ArtifactRepository localRepository, Properties
properties, List goals )
       {
  -        super( localRepository, goals );
  -
  -        type = "initializing";               
  +        super( localRepository, properties, goals );
  +        type = "initializing";
       }
   }
  
  
  
  1.3       +6 -6      maven-components/maven-core/src/main/java/org/apache/maven/execution/project/MavenProjectExecutionRequest.java
  
  Index: MavenProjectExecutionRequest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/project/MavenProjectExecutionRequest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MavenProjectExecutionRequest.java	25 Dec 2004 16:26:24 -0000	1.2
  +++ MavenProjectExecutionRequest.java	3 Feb 2005 11:39:25 -0000	1.3
  @@ -22,22 +22,22 @@
   
   import java.io.File;
   import java.util.List;
  +import java.util.Properties;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
    * @version $Id$
    */
   public class MavenProjectExecutionRequest
  -    extends AbstractMavenExecutionRequest
  +extends AbstractMavenExecutionRequest
   {
       private File pom;
   
  -    public MavenProjectExecutionRequest( ArtifactRepository localRepository, List goals,
File pom )
  +    public MavenProjectExecutionRequest( ArtifactRepository localRepository, Properties
properties, List goals,
  +                                         File pom )
       {
  -        super( localRepository, goals );
  -
  +        super( localRepository, properties, goals );
           this.pom = pom;
  -
           type = "project";
       }
   
  
  
  
  1.3       +6 -10     maven-components/maven-core/src/main/java/org/apache/maven/execution/reactor/MavenReactorExecutionRequest.java
  
  Index: MavenReactorExecutionRequest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/reactor/MavenReactorExecutionRequest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MavenReactorExecutionRequest.java	25 Dec 2004 16:26:24 -0000	1.2
  +++ MavenReactorExecutionRequest.java	3 Feb 2005 11:39:25 -0000	1.3
  @@ -22,30 +22,26 @@
   
   import java.io.File;
   import java.util.List;
  +import java.util.Properties;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
    * @version $Id$
    */
   public class MavenReactorExecutionRequest
  -    extends AbstractMavenExecutionRequest
  +extends AbstractMavenExecutionRequest
   {
       private String includes;
  -
       private String excludes;
  -
       private File baseDirectory;
   
  -    public MavenReactorExecutionRequest( ArtifactRepository localRepository, List goals,
String includes, String excludes, File baseDirectory )
  +    public MavenReactorExecutionRequest( ArtifactRepository localRepository, Properties
properties, List goals,
  +                                         String includes, String excludes, File baseDirectory
)
       {
  -        super( localRepository, goals );
  -
  +        super( localRepository, properties, goals );
           this.includes = includes;
  -
           this.excludes = excludes;
  -
           this.baseDirectory = baseDirectory;
  -
           type = "reactor";
       }
   
  
  
  
  1.4       +7 -24     maven-components/maven-core/src/main/java/org/apache/maven/execution/reactor/MavenReactorExecutionRequestHandler.java
  
  Index: MavenReactorExecutionRequestHandler.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/reactor/MavenReactorExecutionRequestHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MavenReactorExecutionRequestHandler.java	25 Dec 2004 16:26:24 -0000	1.3
  +++ MavenReactorExecutionRequestHandler.java	3 Feb 2005 11:39:25 -0000	1.4
  @@ -35,63 +35,45 @@
    * @version $Id$
    */
   public class MavenReactorExecutionRequestHandler
  -    extends MavenProjectExecutionRequestHandler
  +extends MavenProjectExecutionRequestHandler
   {
       public void handle( MavenExecutionRequest request, MavenExecutionResponse response
)
  -        throws Exception
  +    throws Exception
       {
           List projects = new ArrayList();
  -
           getLogger().info( "Starting the reactor..." );
  -
           try
  -        {
  +              {
               List files = FileUtils.getFiles( new File( System.getProperty( "user.dir" )
),
                                                ( (MavenReactorExecutionRequest) request ).getIncludes(),
                                                ( (MavenReactorExecutionRequest) request ).getExcludes()
);
  -
               for ( Iterator iterator = files.iterator(); iterator.hasNext(); )
               {
                   File file = (File) iterator.next();
  -
                   MavenProject project = getProject( file, request.getLocalRepository() );
  -
                   projects.add( project );
               }
  -
               projects = projectBuilder.getSortedProjects( projects );
           }
           catch ( Exception e )
           {
               throw new ReactorException( "Error processing projects for the reactor: ",
e );
           }
  -
           getLogger().info( "Our processing order:" );
  -
           for ( Iterator iterator = projects.iterator(); iterator.hasNext(); )
           {
               MavenProject project = (MavenProject) iterator.next();
  -
               getLogger().info( project.getName() );
           }
  -
           for ( Iterator iterator = projects.iterator(); iterator.hasNext(); )
           {
               MavenProject project = (MavenProject) iterator.next();
  -
               System.out.println( "\n\n\n" );
  -
               line();
  -
               getLogger().info( "Building " + project.getName() );
  -
               line();
  -
  -            MavenProjectExecutionRequest projectExecutionRequest =
  -                new MavenProjectExecutionRequest( request.getLocalRepository(), request.getGoals(),
project.getFile() );
  -
  +            MavenProjectExecutionRequest projectExecutionRequest = request.createProjectExecutionRequest(
project );
               super.handle( projectExecutionRequest, response );
  -
               if ( response.isExecutionFailure() )
               {
                   break;
  @@ -103,7 +85,8 @@
       // Reactor
       // ----------------------------------------------------------------------
   
  -    public List getSortedProjects( List projects ) throws Exception
  +    public List getSortedProjects( List projects )
  +    throws Exception
       {
           return projectBuilder.getSortedProjects( projects );
       }
  
  
  
  1.4       +18 -7     maven-components/maven-core/src/main/java/org/apache/maven/execution/AbstractMavenExecutionRequest.java
  
  Index: AbstractMavenExecutionRequest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/AbstractMavenExecutionRequest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractMavenExecutionRequest.java	25 Dec 2004 16:26:24 -0000	1.3
  +++ AbstractMavenExecutionRequest.java	3 Feb 2005 11:39:26 -0000	1.4
  @@ -18,29 +18,30 @@
    */
   
   import org.apache.maven.artifact.repository.ArtifactRepository;
  +import org.apache.maven.execution.project.MavenProjectExecutionRequest;
   import org.apache.maven.lifecycle.session.MavenSession;
  +import org.apache.maven.project.MavenProject;
   
   import java.util.List;
  +import java.util.Properties;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
    * @version $Id$
    */
   public class AbstractMavenExecutionRequest
  -    implements MavenExecutionRequest
  +implements MavenExecutionRequest
   {
       protected ArtifactRepository localRepository;
  -
  +    protected final Properties parameters;
       protected List goals;
  -
       protected String type;
  -
       protected MavenSession session;
   
  -    public AbstractMavenExecutionRequest( ArtifactRepository localRepository, List goals
)
  +    public AbstractMavenExecutionRequest( ArtifactRepository localRepository, Properties
parameters, List goals )
       {
           this.localRepository = localRepository;
  -
  +        this.parameters = parameters;
           this.goals = goals;
       }
   
  @@ -59,6 +60,11 @@
           return type;
       }
   
  +    public String getParameter( String name )
  +    {
  +        return parameters.getProperty( name );
  +    }
  +
       // ----------------------------------------------------------------------
       // Putting the session here but it can probably be folded right in here.
       // ----------------------------------------------------------------------
  @@ -72,4 +78,9 @@
       {
           this.session = session;
       }
  +
  +    public MavenProjectExecutionRequest createProjectExecutionRequest( MavenProject project
)
  +    {
  +        return new MavenProjectExecutionRequest( getLocalRepository(), parameters, getGoals(),
project.getFile() );
  +    }
   }
  
  
  
  1.4       +7 -1      maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
  
  Index: MavenExecutionRequest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MavenExecutionRequest.java	25 Dec 2004 16:26:24 -0000	1.3
  +++ MavenExecutionRequest.java	3 Feb 2005 11:39:26 -0000	1.4
  @@ -18,7 +18,9 @@
    */
   
   import org.apache.maven.artifact.repository.ArtifactRepository;
  +import org.apache.maven.execution.project.MavenProjectExecutionRequest;
   import org.apache.maven.lifecycle.session.MavenSession;
  +import org.apache.maven.project.MavenProject;
   
   import java.util.List;
   
  @@ -30,6 +32,8 @@
   {
       ArtifactRepository getLocalRepository();
   
  +    String getParameter( String name );
  +
       List getGoals();
   
       String getType();
  @@ -37,4 +41,6 @@
       void setSession( MavenSession session );
   
       MavenSession getSession();
  +
  +    MavenProjectExecutionRequest createProjectExecutionRequest( MavenProject project );
   }
  
  
  
  1.3       +5 -5      maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenSetupExecutionRequest.java
  
  Index: MavenSetupExecutionRequest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenSetupExecutionRequest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MavenSetupExecutionRequest.java	25 Dec 2004 16:26:24 -0000	1.2
  +++ MavenSetupExecutionRequest.java	3 Feb 2005 11:39:26 -0000	1.3
  @@ -20,18 +20,18 @@
   import org.apache.maven.artifact.repository.ArtifactRepository;
   
   import java.util.List;
  +import java.util.Properties;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
    * @version $Id$
    */
   public class MavenSetupExecutionRequest
  -    extends AbstractMavenExecutionRequest
  +extends AbstractMavenExecutionRequest
   {
  -    public MavenSetupExecutionRequest( ArtifactRepository localRepository, List goals )
  +    public MavenSetupExecutionRequest( ArtifactRepository localRepository, Properties properties,
List goals )
       {
  -        super( localRepository, goals );
  -
  +        super( localRepository, properties, goals );
           type = "setup";
       }
   }
  
  
  
  1.4       +16 -1     maven-components/maven-core/src/main/java/org/apache/maven/project/ProjectDefaultsInjector.java
  
  Index: ProjectDefaultsInjector.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/ProjectDefaultsInjector.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ProjectDefaultsInjector.java	2 Feb 2005 22:13:15 -0000	1.3
  +++ ProjectDefaultsInjector.java	3 Feb 2005 11:39:26 -0000	1.4
  @@ -1,6 +1,21 @@
  -// TODO Attach license header here.
   package org.apache.maven.project;
   
  +/*
  + * Copyright 2001-2005 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   /**
    * @author jdcasey Created on Feb 1, 2005
    */
  
  
  
  1.5       +12 -7     maven-components/maven-core/src/main/java/org/apache/maven/repository/RepositoryUtils.java
  
  Index: RepositoryUtils.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/repository/RepositoryUtils.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RepositoryUtils.java	25 Dec 2004 16:26:25 -0000	1.4
  +++ RepositoryUtils.java	3 Feb 2005 11:39:26 -0000	1.5
  @@ -19,6 +19,7 @@
   
   import org.apache.maven.artifact.repository.ArtifactRepository;
   import org.apache.maven.model.Repository;
  +import org.apache.maven.wagon.authentication.AuthenticationInfo;
   
   import java.util.HashSet;
   import java.util.Iterator;
  @@ -26,30 +27,34 @@
   import java.util.Set;
   
   /**
  - * @todo not sure "wagon" notation is appropriate here - it is really maven-artifact which
is not the same as wagon
    * @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
    * @version $Id$
  + * @todo not sure "wagon" notation is appropriate here - it is really maven-artifact which
is not the same as wagon
    */
   public class RepositoryUtils
   {
       public static Set mavenToWagon( List repositories )
       {
           Set repos = new HashSet();
  -
           for ( Iterator i = repositories.iterator(); i.hasNext(); )
           {
               repos.add( mavenRepositoryToWagonRepository( (Repository) i.next() ) );
           }
  -
           return repos;
       }
  +
       public static ArtifactRepository
  -        mavenRepositoryToWagonRepository( Repository mavenRepository )
  +    mavenRepositoryToWagonRepository( Repository mavenRepository )
       {
           ArtifactRepository retValue = new ArtifactRepository();
  -
  +        if ( mavenRepository.getUsername() != null )
  +        {
  +            AuthenticationInfo authInfo = new AuthenticationInfo();
  +            authInfo.setUserName( mavenRepository.getUsername() );
  +            authInfo.setPassword( mavenRepository.getPassword() );
  +            retValue.setAuthenticationInfo( authInfo );
  +        }
           retValue.setUrl( mavenRepository.getUrl() );
  -
           return retValue;
       }
   
  
  
  
  1.68      +13 -0     maven-components/maven-model/maven.mdo
  
  Index: maven.mdo
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-model/maven.mdo,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- maven.mdo	2 Feb 2005 09:00:54 -0000	1.67
  +++ maven.mdo	3 Feb 2005 11:39:27 -0000	1.68
  @@ -1565,6 +1565,19 @@
             ]]></description>
             <type>String</type>
           </field>
  +        <field>
  +          <name>username</name>
  +          <version>4.0.0</version>
  +          <description>The username to connect to the repository with. If omitted,
none is used.</description>
  +          <type>String</type>
  +        </field>
  +        <!-- @todo this should be encrypted in some way or be a keystore lookup and
m2 can provide a way to generate it -->
  +        <field>
  +          <name>password</name>
  +          <version>4.0.0</version>
  +          <description>The password to use when connecting to the repository. If
omitted, none is used.</description>
  +          <type>String</type>
  +        </field>
         </fields>
         <codeSegments>
           <codeSegment>
  
  
  

Mime
View raw message