maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject cvs commit: maven-components/maven-core/src/main/java/org/apache/maven DefaultMaven.java
Date Wed, 09 Mar 2005 22:13:10 GMT
jdcasey     2005/03/09 14:13:09

  Modified:    maven-user-model maven-user.mdo
               maven-core/src/main/java/org/apache/maven/execution
                        MavenReactorExecutionRequest.java
                        MavenExecutionRequest.java
                        MavenProjectExecutionRequest.java
                        MavenInitializingExecutionRequest.java
                        AbstractMavenExecutionRequest.java
               maven-mboot2/src/main/java MBoot.java
               maven-core/src/main/java/org/apache/maven/cli MavenCli.java
               maven-core/src/main/java/org/apache/maven/util
                        UserModelUtils.java
               maven-core/src/main/java/org/apache/maven DefaultMaven.java
  Log:
  o Added user.xml as the central point of config for local repository, both in MBoot2 and maven proper.
  o Added proxy-profile support to user.xml
  
  Revision  Changes    Path
  1.3       +86 -23    maven-components/maven-user-model/maven-user.mdo
  
  Index: maven-user.mdo
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-user-model/maven-user.mdo,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- maven-user.mdo	9 Mar 2005 05:48:29 -0000	1.2
  +++ maven-user.mdo	9 Mar 2005 22:13:04 -0000	1.3
  @@ -11,11 +11,11 @@
     <classes>
       <class rootElement="true">
         <name>UserModel</name>
  -      <version>4.0.0</version>
  +      <version>1.0.0</version>
         <fields>
           <field>
             <name>jdkProfiles</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <description><![CDATA[Configuration for different java environment profiles.]]></description>
             <association>
               <type>JdkProfile</type>
  @@ -23,8 +23,17 @@
             </association>
           </field>
           <field>
  +          <name>proxyProfiles</name>
  +          <version>1.0.0</version>
  +          <description><![CDATA[Configuration for different proxy profiles.]]></description>
  +          <association>
  +            <type>ProxyProfile</type>
  +            <multiplicity>*</multiplicity>
  +          </association>
  +        </field>
  +        <field>
             <name>serverProfiles</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <description><![CDATA[Server-access profiles.]]></description>
             <association>
               <type>ServerProfile</type>
  @@ -33,7 +42,7 @@
           </field>
           <field>
             <name>mavenProfiles</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <description><![CDATA[Collection of runtime configurations for local repo, etc.]]></description>
             <association>
               <type>MavenProfile</type>
  @@ -42,7 +51,7 @@
           </field>
           <field>
             <name>defaultProfiles</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <association>
               <type>DefaultProfiles</type>
             </association>
  @@ -53,19 +62,19 @@
       <!-- @todo: is any of this too CVS specific? Investigate other SCMs -->
       <class>
         <name>JdkProfile</name>
  -      <version>4.0.0</version>
  +      <version>1.0.0</version>
         <description><![CDATA[Describes one Java environment]]></description>
         <fields>
           <field>
             <name>version</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <required>true</required>
             <description><![CDATA[The JDK major version (eg. '1.4').]]></description>
             <type>String</type>
           </field>
           <field>
             <name>javaHome</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <required>true</required>
             <description><![CDATA[The JDK home.]]></description>
             <type>String</type>
  @@ -73,44 +82,92 @@
         </fields>
       </class>
       <class>
  +      <name>ProxyProfile</name>
  +      <version>1.0.0</version>
  +      <fields>
  +        <field>
  +          <name>id</name>
  +          <version>1.0.0</version>
  +          <description><![CDATA[The unique id for a proxy configuration.]]></description>
  +          <type>String</type>
  +        </field>
  +        <field>
  +          <name>protocol</name>
  +          <version>1.0.0</version>
  +          <description><![CDATA[The proxy protocol.]]></description>
  +          <type>String</type>
  +        </field>
  +        <field>
  +          <name>username</name>
  +          <version>1.0.0</version>
  +          <description><![CDATA[The proxy user.]]></description>
  +          <type>String</type>
  +        </field>
  +        <field>
  +          <name>password</name>
  +          <version>1.0.0</version>
  +          <description><![CDATA[The proxy password.]]></description>
  +          <type>String</type>
  +        </field>
  +        <field>
  +          <name>port</name>
  +          <version>1.0.0</version>
  +          <description><![CDATA[The proxy port.]]></description>
  +          <type>int</type>
  +        </field>
  +        <field>
  +          <name>host</name>
  +          <version>1.0.0</version>
  +          <description><![CDATA[The proxy host.]]></description>
  +          <type>String</type>
  +        </field>
  +        <field>
  +          <name>nonProxyHosts</name>
  +          <version>1.0.0</version>
  +          <description><![CDATA[The non-proxied hosts.]]></description>
  +          <type>String</type>
  +        </field>
  +      </fields>
  +    </class>
  +    <class>
         <name>ServerProfile</name>
  -      <version>4.0.0</version>
  +      <version>1.0.0</version>
         <fields>
           <field>
             <name>id</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <required>true</required>
             <description><![CDATA[The ID of this configuration for external reference.]]></description>
             <type>String</type>
           </field>
           <field>
             <name>host</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <required>true</required>
             <description><![CDATA[The hostname for this configuration.]]></description>
             <type>String</type>
           </field>
           <field>
             <name>username</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <description><![CDATA[The username used to access this server with this config.]]></description>
             <type>String</type>
           </field>
           <field>
             <name>password</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <description><![CDATA[The password used to access this server with this config.]]></description>
             <type>String</type>
           </field>
           <field>
             <name>privateKey</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <description><![CDATA[The private key location used to access this server with this config.]]></description>
             <type>String</type>
           </field>
           <field>
             <name>passphrase</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <description><![CDATA[The passphrase used to access this server with a private key in this config.]]></description>
             <type>String</type>
           </field>
  @@ -118,25 +175,25 @@
       </class>
       <class>
         <name>MavenProfile</name>
  -      <version>4.0.0</version>
  +      <version>1.0.0</version>
         <fields>
           <field>
             <name>id</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <required>true</required>
             <description><![CDATA[The ID of this configuration for external reference.]]></description>
             <type>String</type>
           </field>
           <field>
             <name>localRepository</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <required>true</required>
             <description><![CDATA[The local repository to use for this runtime profile.]]></description>
             <type>String</type>
           </field>
           <field>
             <name>passwordStore</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <required>true</required>
             <description><![CDATA[The keystore used to store passwords for this runtime profile.]]></description>
             <type>String</type>
  @@ -145,23 +202,29 @@
       </class>
       <class>
         <name>DefaultProfiles</name>
  -      <version>4.0.0</version>
  +      <version>1.0.0</version>
         <fields>
           <field>
             <name>serverProfileId</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <required>false</required>
             <type>String</type>
           </field>
           <field>
             <name>mavenProfileId</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
             <required>true</required>
             <type>String</type>
           </field>
           <field>
             <name>jdkVersion</name>
  -          <version>4.0.0</version>
  +          <version>1.0.0</version>
  +          <required>false</required>
  +          <type>String</type>
  +        </field>
  +        <field>
  +          <name>proxyProfileId</name>
  +          <version>1.0.0</version>
             <required>false</required>
             <type>String</type>
           </field>
  
  
  
  1.6       +4 -4      maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenReactorExecutionRequest.java
  
  Index: MavenReactorExecutionRequest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenReactorExecutionRequest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MavenReactorExecutionRequest.java	8 Mar 2005 06:06:22 -0000	1.5
  +++ MavenReactorExecutionRequest.java	9 Mar 2005 22:13:05 -0000	1.6
  @@ -42,10 +42,10 @@
       private File baseDirectory;
   
       public MavenReactorExecutionRequest( ArtifactRepository localRepository, UserModel userModel, EventDispatcher eventDispatcher, 
  -                                         Properties properties, List goals, String includes, 
  +                                         List goals, String includes, 
                                            String excludes, File baseDirectory )
       {
  -        super( localRepository, userModel, eventDispatcher, properties, goals );
  +        super( localRepository, userModel, eventDispatcher, goals );
   
           this.includes = includes;
   
  @@ -79,6 +79,6 @@
   
       public MavenProjectExecutionRequest createProjectExecutionRequest( MavenProject project )
       {
  -        return new MavenProjectExecutionRequest( localRepository, getUserModel(), getEventDispatcher(), parameters, goals, project.getFile() );
  +        return new MavenProjectExecutionRequest( localRepository, getUserModel(), getEventDispatcher(), goals, project.getFile() );
       }
   }
  
  
  
  1.9       +1 -3      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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MavenExecutionRequest.java	8 Mar 2005 06:06:22 -0000	1.8
  +++ MavenExecutionRequest.java	9 Mar 2005 22:13:05 -0000	1.9
  @@ -34,8 +34,6 @@
   {
       ArtifactRepository getLocalRepository();
   
  -    String getParameter( String name );
  -
       List getGoals();
   
       String getType();
  
  
  
  1.5       +2 -4      maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenProjectExecutionRequest.java
  
  Index: MavenProjectExecutionRequest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenProjectExecutionRequest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MavenProjectExecutionRequest.java	8 Mar 2005 06:06:22 -0000	1.4
  +++ MavenProjectExecutionRequest.java	9 Mar 2005 22:13:05 -0000	1.5
  @@ -24,7 +24,6 @@
   import java.io.File;
   import java.util.ArrayList;
   import java.util.List;
  -import java.util.Properties;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  @@ -38,11 +37,10 @@
       public MavenProjectExecutionRequest( ArtifactRepository localRepository,
                                            UserModel userModel,
                                            EventDispatcher eventDispatcher,
  -                                         Properties properties,
                                            List goals,
                                            File pom )
       {
  -        super( localRepository, userModel, eventDispatcher, properties, goals );
  +        super( localRepository, userModel, eventDispatcher, goals );
   
           this.pom = pom;
   
  
  
  
  1.5       +3 -4      maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenInitializingExecutionRequest.java
  
  Index: MavenInitializingExecutionRequest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenInitializingExecutionRequest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MavenInitializingExecutionRequest.java	8 Mar 2005 06:06:22 -0000	1.4
  +++ MavenInitializingExecutionRequest.java	9 Mar 2005 22:13:05 -0000	1.5
  @@ -22,7 +22,6 @@
   import org.apache.maven.monitor.event.EventDispatcher;
   
   import java.util.List;
  -import java.util.Properties;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  @@ -31,9 +30,9 @@
   public class MavenInitializingExecutionRequest
   extends AbstractMavenExecutionRequest
   {
  -    public MavenInitializingExecutionRequest( ArtifactRepository localRepository, UserModel userModel, EventDispatcher eventDispatcher, Properties properties, List goals )
  +    public MavenInitializingExecutionRequest( ArtifactRepository localRepository, UserModel userModel, EventDispatcher eventDispatcher, List goals )
       {
  -        super( localRepository, userModel, eventDispatcher, properties, goals );
  +        super( localRepository, userModel, eventDispatcher, goals );
   
           type = "initializing";
       }
  
  
  
  1.10      +2 -11     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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AbstractMavenExecutionRequest.java	8 Mar 2005 06:06:22 -0000	1.9
  +++ AbstractMavenExecutionRequest.java	9 Mar 2005 22:13:05 -0000	1.10
  @@ -36,8 +36,6 @@
       /** @todo [BP] is this required? This hands off to MavenSession, but could be passed through the handler.handle function (+ createSession). */
       protected ArtifactRepository localRepository;
   
  -    protected final Properties parameters;
  -
       protected List goals;
   
       protected String type;
  @@ -50,14 +48,12 @@
   
       private final UserModel userModel;
   
  -    public AbstractMavenExecutionRequest( ArtifactRepository localRepository, UserModel userModel, EventDispatcher eventDispatcher, Properties parameters, List goals )
  +    public AbstractMavenExecutionRequest( ArtifactRepository localRepository, UserModel userModel, EventDispatcher eventDispatcher, List goals )
       {
           this.localRepository = localRepository;
           
           this.userModel = userModel;
   
  -        this.parameters = parameters;
  -
           this.goals = goals;
           
           this.eventDispatcher = eventDispatcher;
  @@ -83,11 +79,6 @@
           return type;
       }
   
  -    public String getParameter( String name )
  -    {
  -        return parameters.getProperty( name );
  -    }
  -
       // ----------------------------------------------------------------------
       // Putting the session here but it can probably be folded right in here.
       // ----------------------------------------------------------------------
  
  
  
  1.60      +249 -87   maven-components/maven-mboot2/src/main/java/MBoot.java
  
  Index: MBoot.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-mboot2/src/main/java/MBoot.java,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- MBoot.java	9 Mar 2005 05:48:29 -0000	1.59
  +++ MBoot.java	9 Mar 2005 22:13:06 -0000	1.60
  @@ -1,21 +1,25 @@
   
  -import compile.CompilerConfiguration;
  -import compile.JavacCompiler;
  -import download.ArtifactDownloader;
  -import jar.JarMojo;
   import org.xml.sax.Attributes;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
   import org.xml.sax.SAXParseException;
   import org.xml.sax.helpers.DefaultHandler;
  +
   import test.SurefirePlugin;
   import util.Commandline;
   import util.FileUtils;
   import util.IsolatedClassLoader;
   import util.Os;
   
  +import compile.CompilerConfiguration;
  +import compile.JavacCompiler;
  +
  +import download.ArtifactDownloader;
  +import jar.JarMojo;
  +
   import javax.xml.parsers.SAXParser;
   import javax.xml.parsers.SAXParserFactory;
  +
   import java.io.File;
   import java.io.FileInputStream;
   import java.io.FileNotFoundException;
  @@ -24,10 +28,12 @@
   import java.lang.reflect.Method;
   import java.util.ArrayList;
   import java.util.Arrays;
  +import java.util.Collections;
   import java.util.Date;
   import java.util.Iterator;
   import java.util.List;
  -import java.util.Properties;
  +import java.util.Map;
  +import java.util.TreeMap;
   
   public class MBoot
   {
  @@ -103,6 +109,25 @@
           "maven-plugins/maven-resources-plugin",
           "maven-plugins/maven-surefire-plugin",
           "maven-plugins/maven-war-plugin" };
  +    
  +    private static final Map MODELLO_TARGET_VERSIONS;
  +    
  +    private static final Map MODELLO_MODEL_FILES;
  +    
  +    static
  +    {
  +        Map targetVersions = new TreeMap();
  +        targetVersions.put( "maven-model", "4.0.0" );
  +        targetVersions.put( "maven-user-model", "1.0.0" );
  +        
  +        MODELLO_TARGET_VERSIONS = Collections.unmodifiableMap( targetVersions );
  +        
  +        Map modelFiles = new TreeMap();
  +        modelFiles.put( "maven-model", "maven.mdo" );
  +        modelFiles.put( "maven-user-model", "maven-user.mdo" );
  +        
  +        MODELLO_MODEL_FILES = Collections.unmodifiableMap( modelFiles );
  +    }
   
       // ----------------------------------------------------------------------
       // Standard locations for resources in Maven projects.
  @@ -133,7 +158,7 @@
       private ArtifactDownloader downloader;
   
       private ModelReader reader;
  -
  +    
       private String repoLocal;
   
       private List mbootDependencies;
  @@ -157,18 +182,18 @@
           catch ( InvocationTargetException e )
           {
               Throwable target = e.getTargetException();
  -            
  -            if(target instanceof RuntimeException)
  +
  +            if ( target instanceof RuntimeException )
               {
  -                throw (RuntimeException)target;
  +                throw (RuntimeException) target;
               }
  -            else if(target instanceof Exception)
  +            else if ( target instanceof Exception )
               {
  -                throw (Exception)target;
  +                throw (Exception) target;
               }
               else
               {
  -                throw new RuntimeException(target);
  +                throw new RuntimeException( target );
               }
           }
       }
  @@ -181,26 +206,41 @@
   
           if ( mavenRepoLocal == null )
           {
  -            Properties p = new Properties();
  +            UserModelReader userModelReader = new UserModelReader();
   
               try
               {
                   String userHome = System.getProperty( "user.home" );
   
  -                p.load( new FileInputStream( new File( userHome, ".m2/maven.properties" ) ) );
  +                userModelReader.parse( new File( userHome, ".m2/user.xml" ) );
  +                
  +                MavenProfile activeProfile = userModelReader.getActiveMavenProfile();
   
  -                mavenRepoLocal = new File( p.getProperty( "maven.repo.local" ) ).getAbsolutePath();
  +                mavenRepoLocal = new File( activeProfile.getLocalRepo() ).getAbsolutePath();
               }
               catch ( Exception e )
               {
  +                e.printStackTrace();
               }
           }
   
           if ( mavenRepoLocal == null )
           {
  -            System.out.println( "You must have a ~/.m2/maven.properties file and must contain the following entries:" );
  +            System.out.println( "You must have a ~/.m2/user.xml file and must contain at least the following information:\n" );
   
  -            System.out.println( "maven.repo.local = /path/to/your/repository" );
  +            System.out.println( "<userModel>\n  " +
  +                    "<mavenProfiles>\n    " +
  +                    "<mavenProfile>\n      " +
  +                    "<id>someId</id>\n      " +
  +                    "<localRepository>/path/to/your/repository</localRepository>\n    " +
  +                    "</mavenProfile>\n  " +
  +                    "</mavenProfiles>\n  " +
  +                    "<defaultProfiles>\n    " +
  +                    "<mavenProfileId>someId</mavenProfileId>\n  " +
  +                    "</defaultProfiles>\n" +
  +                    "</userModel>\n" );
  +            
  +            System.out.println("where \'someId\' is just an id for matching within the file.");
   
               System.out.println();
   
  @@ -277,7 +317,7 @@
   
               System.setProperty( "basedir", directory );
   
  -            buildProject( directory );
  +            buildProject( directory, builds[i] );
   
               if ( reader.artifactId.equals( "maven-core" ) )
               {
  @@ -301,7 +341,7 @@
   
               System.setProperty( "basedir", directory );
   
  -            buildProject( directory );
  +            buildProject( directory, pluginBuilds[i] );
   
               reader.reset();
   
  @@ -430,7 +470,7 @@
           System.out.println( "Finished at: " + fullStop );
       }
   
  -    public void buildProject( String basedir ) throws Exception
  +    public void buildProject( String basedir, String projectId ) throws Exception
       {
           System.out.println( "Building project in " + basedir );
   
  @@ -479,24 +519,27 @@
           // Generating sources
           // ----------------------------------------------------------------------
   
  -        File base = new File(basedir);
  +        File base = new File( basedir );
           
  -        String[] basedirFiles = base.list();
  +        String modelFileName = (String)MODELLO_MODEL_FILES.get( projectId );
           
           File model = null;
  -        for ( int i = 0; i < basedirFiles.length; i++ )
  +        if(modelFileName != null && modelFileName.trim().length() > 0)
           {
  -            if(basedirFiles[i].endsWith(".mdo"))
  -            {
  -                model = new File(base, basedirFiles[i]);
  -                break;
  -            }
  +            model = new File(base, modelFileName);
           }
  -
  +        
           if ( model != null && model.exists() )
           {
               System.out.println( "Model exists!" );
   
  +            String modelVersion = (String)MODELLO_TARGET_VERSIONS.get( projectId );
  +            if(modelVersion == null || modelVersion.trim().length() < 1)
  +            {
  +                System.out.println("No model version configured. Using \'1.0.0\'...");
  +                modelVersion = "1.0.0";
  +            }
  +            
               File generatedSourcesDirectory = new File( basedir, GENERATED_SOURCES );
   
               if ( !generatedSourcesDirectory.exists() )
  @@ -510,23 +553,25 @@
               {
                   generatedDocsDirectory.mkdirs();
               }
  -
  -            generateSources( model.getAbsolutePath(), "java", generatedSources, "4.0.0", "false" );
  +            
  +            System.out.println("Generating model bindings for version \'" + modelVersion + "\' in project: " + projectId);
  +            
  +            generateSources( model.getAbsolutePath(), "java", generatedSources, modelVersion, "false" );
   
               //generateSources( model.getAbsolutePath(), "java",
               // generatedSources, "3.0.0", "true" );
   
  -            generateSources( model.getAbsolutePath(), "xpp3-reader", generatedSources, "4.0.0", "false" );
  +            generateSources( model.getAbsolutePath(), "xpp3-reader", generatedSources, modelVersion, "false" );
   
               //generateSources( model.getAbsolutePath(), "xpp3-reader",
               // generatedSources, "3.0.0", "true" );
   
  -            generateSources( model.getAbsolutePath(), "xpp3-writer", generatedSources, "4.0.0", "false" );
  +            generateSources( model.getAbsolutePath(), "xpp3-writer", generatedSources, modelVersion, "false" );
   
               //generateSources( model.getAbsolutePath(), "xpp3-writer",
               // generatedSources, "3.0.0", "true" );
   
  -            generateSources( model.getAbsolutePath(), "xdoc", generatedDocs, "4.0.0", "false" );
  +            generateSources( model.getAbsolutePath(), "xdoc", generatedDocs, modelVersion, "false" );
   
               //generateSources( model.getAbsolutePath(), "xdoc", generatedDocs,
               // "3.0.0", "true" );
  @@ -555,8 +600,7 @@
           {
               System.out.println( "Generating maven plugin descriptor ..." );
   
  -            generatePluginDescriptor( sources,
  -                                      new File( classes, "META-INF/maven" ).getAbsolutePath(),
  +            generatePluginDescriptor( sources, new File( classes, "META-INF/maven" ).getAbsolutePath(),
                                         new File( basedir, "pom.xml" ).getAbsolutePath() );
           }
   
  @@ -634,7 +678,7 @@
               if ( !f.exists() )
               {
                   throw new FileNotFoundException( "Missing dependency: " + dependency
  -                    + (!online ? "; run again online" : "; there was a problem downloading it earlier") );
  +                    + ( !online ? "; run again online" : "; there was a problem downloading it earlier" ) );
               }
   
               cl.addURL( f.toURL() );
  @@ -651,7 +695,7 @@
               if ( !f.exists() )
               {
                   throw new FileNotFoundException( "Missing dependency: " + dependency
  -                    + (!online ? "; run again online" : "; there was a problem downloading it earlier") );
  +                    + ( !online ? "; run again online" : "; there was a problem downloading it earlier" ) );
               }
   
               cl.addURL( f.toURL() );
  @@ -683,7 +727,7 @@
               if ( !f.exists() )
               {
                   throw new FileNotFoundException( "Missing dependency: " + dependency
  -                    + (!online ? "; run again online" : "; there was a problem downloading it earlier") );
  +                    + ( !online ? "; run again online" : "; there was a problem downloading it earlier" ) );
               }
   
               modelloClassLoader.addURL( f.toURL() );
  @@ -834,12 +878,7 @@
               excludes.add( "**/*Abstract*.java" );
           }
   
  -        boolean success = testRunner.execute( repoLocal,
  -                                              basedir,
  -                                              classes,
  -                                              testClasses,
  -                                              includes,
  -                                              excludes,
  +        boolean success = testRunner.execute( repoLocal, basedir, classes, testClasses, includes, excludes,
                                                 classpath( reader.getDependencies(), null ) );
   
           if ( !success )
  @@ -887,7 +926,7 @@
       }
   
       private void compile( List dependencies, String sourceDirectory, String outputDirectory, String extraClasspath,
  -        String generatedSources ) throws Exception
  +                         String generatedSources ) throws Exception
       {
           JavacCompiler compiler = new JavacCompiler();
   
  @@ -984,9 +1023,62 @@
       {
           return d.getArtifactDirectory() + pathSeparator + d.getType() + "s" + pathSeparator + d.getArtifact();
       }
  +    
  +    abstract class AbstractReader extends DefaultHandler
  +    {
  +        private File file;
  +        private SAXParserFactory saxFactory;
  +
  +        public abstract void reset();
  +        
  +        public boolean parse( File file )
  +        {
  +            this.file = file;
  +
  +            try
  +            {
  +                saxFactory = SAXParserFactory.newInstance();
  +
  +                SAXParser parser = saxFactory.newSAXParser();
  +
  +                InputSource is = new InputSource( new FileInputStream( file ) );
  +
  +                parser.parse( is, this );
  +
  +                return true;
  +            }
  +            catch ( Exception e )
  +            {
  +                e.printStackTrace();
  +
  +                return false;
  +            }
  +        }
  +
  +        public void warning( SAXParseException spe )
  +        {
  +            printParseError( "Warning", spe );
  +        }
  +
  +        public void error( SAXParseException spe )
  +        {
  +            printParseError( "Error", spe );
  +        }
  +
  +        public void fatalError( SAXParseException spe )
  +        {
  +            printParseError( "Fatal Error", spe );
  +        }
  +
  +        private final void printParseError( String type, SAXParseException spe )
  +        {
  +            System.err.println( type + " [line " + spe.getLineNumber() + ", row " + spe.getColumnNumber() + "]: "
  +                + spe.getMessage() );
  +        }
  +    }
   
       class ModelReader
  -        extends DefaultHandler
  +        extends AbstractReader
       {
           int depth = 0;
   
  @@ -1016,8 +1108,6 @@
   
           private Resource currentResource;
   
  -        private SAXParserFactory saxFactory;
  -
           private boolean insideParent = false;
   
           private boolean insideDependency = false;
  @@ -1030,8 +1120,6 @@
   
           private StringBuffer bodyText = new StringBuffer();
   
  -        private File file;
  -
           public void reset()
           {
               dependencies = new ArrayList();
  @@ -1057,30 +1145,6 @@
               return resources;
           }
   
  -        public boolean parse( File file )
  -        {
  -            this.file = file;
  -
  -            try
  -            {
  -                saxFactory = SAXParserFactory.newInstance();
  -
  -                SAXParser parser = saxFactory.newSAXParser();
  -
  -                InputSource is = new InputSource( new FileInputStream( file ) );
  -
  -                parser.parse( is, this );
  -
  -                return true;
  -            }
  -            catch ( Exception e )
  -            {
  -                e.printStackTrace();
  -
  -                return false;
  -            }
  -        }
  -
           public void startElement( String uri, String localName, String rawName, Attributes attributes )
           {
               if ( rawName.equals( "parent" ) )
  @@ -1109,7 +1173,7 @@
   
                   insideResource = true;
               }
  -            depth ++;
  +            depth++;
           }
   
           public void characters( char buffer[], int start, int length )
  @@ -1290,29 +1354,127 @@
   
               bodyText = new StringBuffer();
   
  -            depth --;
  +            depth--;
           }
  +    }
   
  -        public void warning( SAXParseException spe )
  +    class UserModelReader
  +        extends AbstractReader
  +    {
  +
  +        private Map mavenProfiles = new TreeMap();
  +
  +        private MavenProfile currentProfile = null;
  +
  +        private StringBuffer currentBody = new StringBuffer();
  +
  +        private String activeProfileId = null;
  +
  +        private MavenProfile activeMavenProfile = null;
  +
  +        public MavenProfile getActiveMavenProfile()
           {
  -            printParseError( "Warning", spe );
  +            return activeMavenProfile;
           }
   
  -        public void error( SAXParseException spe )
  +        public void characters( char[] ch, int start, int length ) throws SAXException
           {
  -            printParseError( "Error", spe );
  +            currentBody.append( ch, start, length );
           }
   
  -        public void fatalError( SAXParseException spe )
  +        public void endElement( String uri, String localName, String rawName ) throws SAXException
           {
  -            printParseError( "Fatal Error", spe );
  +            if ( "mavenProfile".equals( rawName ) )
  +            {
  +                if ( notEmpty( currentProfile.getId() ) && notEmpty( currentProfile.getLocalRepo() ) )
  +                {
  +                    mavenProfiles.put( currentProfile.getId(), currentProfile );
  +                    currentProfile = null;
  +                }
  +                else
  +                {
  +                    throw new SAXException( "Invalid mavenProfile entry. Missing one or more "
  +                        + "fields: {id,localRepository}." );
  +                }
  +            }
  +            else if ( currentProfile != null )
  +            {
  +                if ( "id".equals( rawName ) )
  +                {
  +                    currentProfile.setId( currentBody.toString().trim() );
  +                }
  +                else if ( "localRepository".equals( rawName ) )
  +                {
  +                    currentProfile.setLocalRepo( currentBody.toString().trim() );
  +                }
  +                else
  +                {
  +                    throw new SAXException( "Illegal element inside mavenProfile: \'" + rawName + "\'" );
  +                }
  +            }
  +            else if ( "userModel".equals( rawName ) )
  +            {
  +                this.activeMavenProfile = (MavenProfile) mavenProfiles.get( activeProfileId );
  +            }
  +            else if ( "mavenProfileId".equals( rawName ) )
  +            {
  +                this.activeProfileId = currentBody.toString().trim();
  +            }
  +            
  +            currentBody = new StringBuffer();
           }
   
  -        private final void printParseError( String type, SAXParseException spe )
  +        private boolean notEmpty( String test )
           {
  -            System.err.println( type + " [line " + spe.getLineNumber() + ", row " + spe.getColumnNumber() + "]: "
  -                + spe.getMessage() );
  +            return test != null && test.trim().length() > 0;
           }
  +
  +        public void startElement( String uri, String localName, String rawName, Attributes attributes )
  +            throws SAXException
  +        {
  +            if ( "mavenProfile".equals( rawName ) )
  +            {
  +                currentProfile = new MavenProfile();
  +            }
  +        }
  +
  +        public void reset()
  +        {
  +            this.currentBody = null;
  +            this.activeMavenProfile = null;
  +            this.activeProfileId = null;
  +            this.currentProfile = null;
  +            this.mavenProfiles.clear();
  +        }
  +    }
  +
  +    public static class MavenProfile
  +    {
  +
  +        private String localRepo;
  +
  +        private String id;
  +
  +        public void setLocalRepo( String localRepo )
  +        {
  +            this.localRepo = localRepo;
  +        }
  +
  +        public String getLocalRepo()
  +        {
  +            return localRepo;
  +        }
  +
  +        public void setId( String id )
  +        {
  +            this.id = id;
  +        }
  +
  +        public String getId()
  +        {
  +            return id;
  +        }
  +
       }
   
       public static class Dependency
  @@ -1585,4 +1747,4 @@
               this.filtering = filtering;
           }
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.16      +51 -70    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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- MavenCli.java	8 Mar 2005 06:06:21 -0000	1.15
  +++ MavenCli.java	9 Mar 2005 22:13:06 -0000	1.16
  @@ -33,6 +33,7 @@
   import org.apache.maven.execution.MavenInitializingExecutionRequest;
   import org.apache.maven.execution.MavenProjectExecutionRequest;
   import org.apache.maven.execution.MavenReactorExecutionRequest;
  +import org.apache.maven.model.user.MavenProfile;
   import org.apache.maven.model.user.UserModel;
   import org.apache.maven.monitor.event.DefaultEventDispatcher;
   import org.apache.maven.monitor.event.DefaultEventMonitor;
  @@ -62,8 +63,7 @@
   
       public static File userDir = new File( System.getProperty( "user.dir" ) );
   
  -    public static int main( String[] args, ClassWorld classWorld )
  -        throws Exception
  +    public static int main( String[] args, ClassWorld classWorld ) throws Exception
       {
           // ----------------------------------------------------------------------
           // Setup the command line parser
  @@ -81,11 +81,11 @@
           //
           // ----------------------------------------------------------------------
   
  -        File userConfigurationDirectory = getUserConfigurationDirectory();
  +        //        File userConfigurationDirectory = getUserConfigurationDirectory();
   
  -        Properties mavenProperties = getMavenProperties( userConfigurationDirectory );
  +        //        Properties mavenProperties = getMavenProperties( userConfigurationDirectory );
   
  -        ArtifactRepository localRepository = getLocalRepository( mavenProperties, userConfigurationDirectory );
  +        ArtifactRepository localRepository = getLocalRepository();
   
           // ----------------------------------------------------------------------
           //
  @@ -117,11 +117,11 @@
           MavenExecutionRequest request = null;
   
           File projectFile = new File( userDir, POMv4 );
  -        
  +
           EventDispatcher eventDispatcher = new DefaultEventDispatcher();
  -        
  +
           UserModel userModel = UserModelUtils.getUserModel();
  -        
  +
           if ( projectFile.exists() )
           {
               if ( commandLine.hasOption( CLIManager.REACTOR ) )
  @@ -130,28 +130,19 @@
   
                   String excludes = System.getProperty( "maven.reactor.excludes", POMv4 );
   
  -                request = new MavenReactorExecutionRequest( localRepository,
  -                                                            userModel,
  -                                                            eventDispatcher,
  -                                                            mavenProperties,
  -                                                            commandLine.getArgList(),
  -                                                            includes,
  -                                                            excludes,
  -                                                            userDir );
  +                request = new MavenReactorExecutionRequest( localRepository, userModel, eventDispatcher,
  +                                                            commandLine.getArgList(), includes, excludes, userDir );
               }
               else
               {
  -                request = new MavenProjectExecutionRequest( localRepository,
  -                                                            userModel,
  -                                                            eventDispatcher,
  -                                                            mavenProperties,
  -                                                            commandLine.getArgList(),
  -                                                            projectFile );
  +                request = new MavenProjectExecutionRequest( localRepository, userModel, eventDispatcher,
  +                                                            commandLine.getArgList(), projectFile );
               }
           }
           else
           {
  -            request = new MavenInitializingExecutionRequest( localRepository, userModel, eventDispatcher, mavenProperties, commandLine.getArgList() );
  +            request = new MavenInitializingExecutionRequest( localRepository, userModel, eventDispatcher,
  +                                                             commandLine.getArgList() );
           }
   
           // ----------------------------------------------------------------------
  @@ -174,10 +165,10 @@
           if ( logger != null )
           {
               request.setLog( new DefaultLog( logger ) );
  -            
  +
               request.addEventMonitor( new DefaultEventMonitor( logger ) );
           }
  -        
  +
           // TODO [BP]: doing this here as it is CLI specific, though it doesn't feel like the right place (likewise logger).
           WagonManager wagonManager = (WagonManager) embedder.lookup( WagonManager.ROLE );
           wagonManager.setDownloadMonitor( new ConsoleDownloadMonitor() );
  @@ -273,48 +264,30 @@
           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 ) );
  +            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 );
  @@ -359,12 +332,20 @@
           return mavenProperties;
       }
   
  -    protected static ArtifactRepository getLocalRepository( Properties mavenProperties,
  -                                                            File userConfigurationDirectory )
  +    protected static ArtifactRepository getLocalRepository() throws Exception
       {
  -        String localRepository = mavenProperties.getProperty( MavenConstants.MAVEN_REPO_LOCAL );
  +        UserModel userModel = UserModelUtils.getUserModel();
  +        MavenProfile mavenProfile = UserModelUtils.getActiveMavenProfile( userModel );
  +
  +        String localRepository = null;
  +        if ( mavenProfile != null )
  +        {
  +            localRepository = mavenProfile.getLocalRepository();
  +        }
  +
           if ( localRepository == null )
           {
  +            String userConfigurationDirectory = System.getProperty( "user.home" );
               localRepository = new File( userConfigurationDirectory, MavenConstants.MAVEN_REPOSITORY ).getAbsolutePath();
           }
   
  @@ -372,4 +353,4 @@
           System.setProperty( MavenConstants.MAVEN_REPO_LOCAL, localRepository );
           return new ArtifactRepository( "local", "file://" + localRepository );
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.3       +91 -0     maven-components/maven-core/src/main/java/org/apache/maven/util/UserModelUtils.java
  
  Index: UserModelUtils.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/util/UserModelUtils.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UserModelUtils.java	9 Mar 2005 05:48:30 -0000	1.2
  +++ UserModelUtils.java	9 Mar 2005 22:13:07 -0000	1.3
  @@ -1,5 +1,8 @@
   package org.apache.maven.util;
   
  +import org.apache.maven.model.user.DefaultProfiles;
  +import org.apache.maven.model.user.MavenProfile;
  +import org.apache.maven.model.user.ProxyProfile;
   import org.apache.maven.model.user.ServerProfile;
   import org.apache.maven.model.user.UserModel;
   import org.apache.maven.model.user.io.xpp3.MavenUserModelXpp3Reader;
  @@ -20,10 +23,98 @@
   
       private static final String USER_MODEL_LOCATION = "/.m2/user.xml";
   
  +    private static final String ACTIVE_MAVEN_PROFILE_ID_ENVAR = "maven.profile";
  +
       private UserModelUtils()
       {
       }
   
  +    public static MavenProfile getActiveMavenProfile( UserModel userModel )
  +    {
  +        String activeProfileId = System.getProperty( ACTIVE_MAVEN_PROFILE_ID_ENVAR );
  +        if ( activeProfileId == null || activeProfileId.trim().length() < 1 )
  +        {
  +            DefaultProfiles defaults = userModel.getDefaultProfiles();
  +            if ( defaults != null )
  +            {
  +                activeProfileId = defaults.getMavenProfileId();
  +            }
  +        }
  +
  +        MavenProfile activeProfile = null;
  +
  +        if ( activeProfileId != null && activeProfileId.trim().length() > 0 )
  +        {
  +            activeProfile = UserModelUtils.getMavenProfile( userModel, activeProfileId );
  +        }
  +
  +        return activeProfile;
  +    }
  +
  +    public static ProxyProfile getActiveProxyProfile( UserModel userModel )
  +    {
  +        String activeProfileId = System.getProperty( ACTIVE_MAVEN_PROFILE_ID_ENVAR );
  +        if ( activeProfileId == null || activeProfileId.trim().length() < 1 )
  +        {
  +            DefaultProfiles defaults = userModel.getDefaultProfiles();
  +            if ( defaults != null )
  +            {
  +                activeProfileId = defaults.getProxyProfileId();
  +            }
  +        }
  +
  +        ProxyProfile activeProfile = null;
  +
  +        if ( activeProfileId != null && activeProfileId.trim().length() > 0 )
  +        {
  +            activeProfile = UserModelUtils.getProxyProfile( userModel, activeProfileId );
  +        }
  +
  +        return activeProfile;
  +    }
  +
  +    public static MavenProfile getMavenProfile( UserModel userModel, String mavenProfileId )
  +    {
  +        MavenProfile result = null;
  +
  +        List mavenProfiles = userModel.getMavenProfiles();
  +        if ( mavenProfiles != null )
  +        {
  +            for ( Iterator it = mavenProfiles.iterator(); it.hasNext(); )
  +            {
  +                MavenProfile profile = (MavenProfile) it.next();
  +                if ( mavenProfileId.equals( profile.getId() ) )
  +                {
  +                    result = profile;
  +                    break;
  +                }
  +            }
  +        }
  +
  +        return result;
  +    }
  +
  +    public static ProxyProfile getProxyProfile( UserModel userModel, String proxyProfileId )
  +    {
  +        ProxyProfile result = null;
  +
  +        List proxyProfile = userModel.getProxyProfiles();
  +        if ( proxyProfile != null )
  +        {
  +            for ( Iterator it = proxyProfile.iterator(); it.hasNext(); )
  +            {
  +                ProxyProfile profile = (ProxyProfile) it.next();
  +                if ( proxyProfileId.equals( profile.getId() ) )
  +                {
  +                    result = profile;
  +                    break;
  +                }
  +            }
  +        }
  +
  +        return result;
  +    }
  +
       public static ServerProfile getServerProfile( UserModel userModel, String serverProfileId )
       {
           ServerProfile result = null;
  
  
  
  1.25      +18 -30    maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
  
  Index: DefaultMaven.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- DefaultMaven.java	8 Mar 2005 06:06:22 -0000	1.24
  +++ DefaultMaven.java	9 Mar 2005 22:13:07 -0000	1.25
  @@ -26,6 +26,8 @@
   import org.apache.maven.execution.MavenSession;
   import org.apache.maven.lifecycle.GoalNotFoundException;
   import org.apache.maven.lifecycle.LifecycleExecutor;
  +import org.apache.maven.model.user.ProxyProfile;
  +import org.apache.maven.model.user.UserModel;
   import org.apache.maven.monitor.event.EventDispatcher;
   import org.apache.maven.monitor.event.MavenEvents;
   import org.apache.maven.plugin.PluginManager;
  @@ -33,6 +35,7 @@
   import org.apache.maven.project.MavenProjectBuilder;
   import org.apache.maven.project.ProjectBuildingException;
   import org.apache.maven.reactor.ReactorException;
  +import org.apache.maven.util.UserModelUtils;
   import org.codehaus.plexus.PlexusConstants;
   import org.codehaus.plexus.PlexusContainer;
   import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
  @@ -265,13 +268,8 @@
   
       protected MavenSession createSession( MavenExecutionRequest request )
       {
  -        return new MavenSession( container,
  -                                 pluginManager,
  -                                 request.getUserModel(),
  -                                 request.getLocalRepository(),
  -                                 request.getEventDispatcher(),
  -                                 request.getLog(),
  -                                 request.getGoals() );
  +        return new MavenSession( container, pluginManager, request.getUserModel(), request.getLocalRepository(),
  +                                 request.getEventDispatcher(), request.getLog(), request.getGoals() );
       }
   
       /**
  @@ -282,28 +280,17 @@
       {
           WagonManager wagonManager = (WagonManager) container.lookup( WagonManager.ROLE );
   
  -        if ( request.getParameter( "maven.proxy.http.host" ) != null )
  +        UserModel userModel = request.getUserModel();
  +
  +        ProxyProfile proxyProfile = UserModelUtils.getActiveProxyProfile( userModel );
  +
  +        if ( proxyProfile != null )
           {
  -            String p = request.getParameter( "maven.proxy.http.port" );
  -            int port = 8080;
  -            if ( p != null )
  -            {
  -                try
  -                {
  -                    port = Integer.valueOf( p ).intValue();
  -                }
  -                catch ( NumberFormatException e )
  -                {
  -                    getLogger().warn( "maven.proxy.http.port was not valid" );
  -                }
  -            }
  -            wagonManager.setProxy( "http",
  -                                   request.getParameter( "maven.proxy.http.host" ),
  -                                   port,
  -                                   request.getParameter( "maven.proxy.http.username" ),
  -                                   request.getParameter( "maven.proxy.http.password" ),
  -                                   request.getParameter( "maven.proxy.http.nonProxyHosts" ) );
  +            wagonManager.setProxy( proxyProfile.getProtocol(), proxyProfile.getHost(), proxyProfile.getPort(),
  +                                   proxyProfile.getUsername(), proxyProfile.getPassword(),
  +                                   proxyProfile.getNonProxyHosts() );
           }
  +
       }
   
       // ----------------------------------------------------------------------
  @@ -384,8 +371,9 @@
   
           Runtime r = Runtime.getRuntime();
   
  -        getLogger().info( "Final Memory: " + ((r.totalMemory() - r.freeMemory()) / mb) + "M/" + (r.totalMemory() / mb)
  -            + "M" );
  +        getLogger().info(
  +                          "Final Memory: " + ( ( r.totalMemory() - r.freeMemory() ) / mb ) + "M/"
  +                              + ( r.totalMemory() / mb ) + "M" );
       }
   
       protected void line()
  
  
  

Mime
View raw message