maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Casey <jdca...@commonjava.org>
Subject Re: cvs commit: maven-components/maven-core/src/main/java/org/apache/maven DefaultMaven.java
Date Tue, 08 Mar 2005 06:12:35 GMT
[ADDENDUM]

I hit the wrong key when I was typing this CVS log, so this is the rest 
of the info.

o Created UserModel support with ServerProfile, MavenProfile, and Jdk 
support for providing multiple security/host, local repo, and jvm 
runtime modes.

o Integrated UserModel with MavenExecutionRequest and MavenSession

o Added support for pick-first-match searching for *.mdo in a given 
project within MBoot2

-j

jdcasey@apache.org wrote:
> jdcasey     2005/03/07 22:06:22
> 
>   Modified:    maven-mboot2/src/main/java MBoot.java
>                maven-core/src/test/java/org/apache/maven/plugin
>                         PluginParameterExpressionEvaluatorTest.java
>                maven-core/src/main/java/org/apache/maven/cli MavenCli.java
>                maven-core/src/main/java/org/apache/maven/execution
>                         MavenExecutionRequest.java
>                         MavenProjectExecutionRequest.java MavenSession.java
>                         MavenReactorExecutionRequest.java
>                         MavenInitializingExecutionRequest.java
>                         AbstractMavenExecutionRequest.java
>                .        .cvsignore
>                maven-core/src/main/java/org/apache/maven/project/interpolation
>                         RegexBasedModelInterpolator.java
>                maven-core pom.xml
>                maven-core/src/main/java/org/apache/maven DefaultMaven.java
>   Added:       maven-user-model maven-user.mdo pom.xml
>                maven-core/src/main/java/org/apache/maven/util
>                         UserModelUtils.java
>   Log:
>   o Added (pom|project)? to the eval pattern in the regex param extractor, to trim ${project.artifactid}
to mean the same as ${artifactId} within the pom.
>   
>   Revision  Changes    Path
>   1.1                  maven-components/maven-user-model/maven-user.mdo
>   
>   Index: maven-user.mdo
>   ===================================================================
>   <model>
>     <id>mavenUserModel</id>
>     <name>MavenUserModel</name>
>     <description><![CDATA[Maven's user-config model for Java project.]]></description>
>     <defaults>
>       <default>
>         <key>package</key>
>         <value>org.apache.maven.model.user</value>
>       </default>
>     </defaults>
>     <classes>
>       <class rootElement="true">
>         <name>UserModel</name>
>         <version>4.0.0</version>
>         <fields>
>           <field>
>             <name>jdkProfiles</name>
>             <version>4.0.0</version>
>             <description><![CDATA[Configuration for different java environment
profiles.]]></description>
>             <association>
>               <type>JdkProfile</type>
>               <multiplicity>*</multiplicity>
>             </association>
>           </field>
>           <field>
>             <name>serverProfiles</name>
>             <version>4.0.0</version>
>             <description><![CDATA[Server-access profiles.]]></description>
>             <association>
>               <type>ServerProfile</type>
>               <multiplicity>*</multiplicity>
>             </association>
>           </field>
>           <field>
>             <name>mavenProfiles</name>
>             <version>4.0.0</version>
>             <description><![CDATA[Collection of runtime configurations for local
repo, etc.]]></description>
>             <association>
>               <type>MavenProfile</type>
>               <multiplicity>*</multiplicity>
>             </association>
>           </field>
>           <field>
>             <name>defaultProfiles</name>
>             <version>4.0.0</version>
>             <association>
>               <type>DefaultProfiles</type>
>             </association>
>           </field>
>         </fields>
>         <codeSegments/>
>       </class>
>       <!-- @todo: is any of this too CVS specific? Investigate other SCMs -->
>       <class>
>         <name>JdkProfile</name>
>         <version>4.0.0</version>
>         <description><![CDATA[Describes one Java environment]]></description>
>         <fields>
>           <field>
>             <name>version</name>
>             <version>4.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>
>             <required>true</required>
>             <description><![CDATA[The JDK home.]]></description>
>             <type>String</type>
>           </field>
>         </fields>
>       </class>
>       <class>
>         <name>ServerProfile</name>
>         <version>4.0.0</version>
>         <fields>
>           <field>
>             <name>id</name>
>             <version>4.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>
>             <required>true</required>
>             <description><![CDATA[The hostname for this configuration.]]></description>
>             <type>String</type>
>           </field>
>           <field>
>             <name>username</name>
>             <version>4.0.0</version>
>             <description><![CDATA[The username used to access this server with
this config.]]></description>
>             <type>String</type>
>           </field>
>           <field>
>             <name>passphrase</name>
>             <version>4.0.0</version>
>             <description><![CDATA[The passphrase used to access this server
with this config.]]></description>
>             <type>String</type>
>           </field>
>           <field>
>             <name>privateKey</name>
>             <version>4.0.0</version>
>             <description><![CDATA[The private key location used to access this
server with this config.]]></description>
>             <type>String</type>
>           </field>
>         </fields>
>       </class>
>       <class>
>         <name>MavenProfile</name>
>         <version>4.0.0</version>
>         <fields>
>           <field>
>             <name>id</name>
>             <version>4.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>
>             <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>
>             <required>true</required>
>             <description><![CDATA[The keystore used to store passwords for this
runtime profile.]]></description>
>             <type>String</type>
>           </field>
>         </fields>
>       </class>
>       <class>
>         <name>DefaultProfiles</name>
>         <version>4.0.0</version>
>         <fields>
>           <field>
>             <name>serverProfileId</name>
>             <version>4.0.0</version>
>             <required>false</required>
>             <type>String</type>
>           </field>
>           <field>
>             <name>mavenProfileId</name>
>             <version>4.0.0</version>
>             <required>true</required>
>             <type>String</type>
>           </field>
>           <field>
>             <name>jdkVersion</name>
>             <version>4.0.0</version>
>             <required>false</required>
>             <type>String</type>
>           </field>
>         </fields>
>       </class>
>     </classes>
>   </model>
>   
>   
>   1.1                  maven-components/maven-user-model/pom.xml
>   
>   Index: pom.xml
>   ===================================================================
>   <project>
>     <modelVersion>4.0.0</modelVersion>
>     <parent>
>       <groupId>maven</groupId>
>       <artifactId>maven-component</artifactId>
>       <version>2.0-SNAPSHOT</version>
>     </parent>
>     
>     <artifactId>maven-user-model</artifactId>
>   </project>
>   
>   
>   1.58      +15 -2     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.57
>   retrieving revision 1.58
>   diff -u -r1.57 -r1.58
>   --- MBoot.java	7 Mar 2005 19:03:18 -0000	1.57
>   +++ MBoot.java	8 Mar 2005 06:06:21 -0000	1.58
>   @@ -79,6 +79,7 @@
>    
>        String[] builds = new String[] {
>            "maven-model",
>   +        "maven-user-model",
>            "maven-monitor",
>            "maven-plugin",
>            "maven-artifact",
>   @@ -477,9 +478,21 @@
>            // Generating sources
>            // ----------------------------------------------------------------------
>    
>   -        File model = new File( basedir, "maven.mdo" );
>   +        File base = new File(basedir);
>   +        
>   +        String[] basedirFiles = base.list();
>   +        
>   +        File model = null;
>   +        for ( int i = 0; i < basedirFiles.length; i++ )
>   +        {
>   +            if(basedirFiles[i].endsWith(".mdo"))
>   +            {
>   +                model = new File(base, basedirFiles[i]);
>   +                break;
>   +            }
>   +        }
>    
>   -        if ( model.exists() )
>   +        if ( model != null && model.exists() )
>            {
>                System.out.println( "Model exists!" );
>    
>   
>   
>   
>   1.5       +5 -4      maven-components/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
>   
>   Index: PluginParameterExpressionEvaluatorTest.java
>   ===================================================================
>   RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java,v
>   retrieving revision 1.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- PluginParameterExpressionEvaluatorTest.java	7 Mar 2005 19:03:18 -0000	1.4
>   +++ PluginParameterExpressionEvaluatorTest.java	8 Mar 2005 06:06:21 -0000	1.5
>   @@ -5,6 +5,7 @@
>    import org.apache.maven.execution.MavenSession;
>    import org.apache.maven.model.Build;
>    import org.apache.maven.model.Model;
>   +import org.apache.maven.model.user.UserModel;
>    import org.apache.maven.monitor.event.DefaultEventDispatcher;
>    import org.apache.maven.monitor.logging.DefaultLog;
>    import org.apache.maven.project.MavenProject;
>   @@ -41,7 +42,7 @@
>            PluginManager mgr = (PluginManager)lookup(PluginManager.ROLE);
>            
>            PlexusContainer container = getContainer();
>   -        MavenSession session = new MavenSession(container, mgr, repo, new DefaultEventDispatcher(),
new DefaultLog(container.getLogger()), Collections.EMPTY_LIST);
>   +        MavenSession session = new MavenSession(container, mgr, new UserModel(), repo,
new DefaultEventDispatcher(), new DefaultLog(container.getLogger()), Collections.EMPTY_LIST);
>            
>            Build build = new Build();
>            build.setDirectory(expected.substring(0, expected.length() - "/classes".length()));
>   @@ -73,7 +74,7 @@
>            PluginManager mgr = (PluginManager)lookup(PluginManager.ROLE);
>            
>            PlexusContainer container = getContainer();
>   -        MavenSession session = new MavenSession(container, mgr, repo, new DefaultEventDispatcher(),
new DefaultLog(container.getLogger()), Collections.EMPTY_LIST);
>   +        MavenSession session = new MavenSession(container, mgr, new UserModel(), repo,
new DefaultEventDispatcher(), new DefaultLog(container.getLogger()), Collections.EMPTY_LIST);
>            Object value = PluginParameterExpressionEvaluator.evaluate( role, session
);
>    
>            assertNotNull( value );
>   @@ -86,7 +87,7 @@
>            PluginManager mgr = (PluginManager)lookup(PluginManager.ROLE);
>            
>            PlexusContainer container = getContainer();
>   -        MavenSession session = new MavenSession(container, mgr, repo, new DefaultEventDispatcher(),
new DefaultLog(container.getLogger()), Collections.EMPTY_LIST);
>   +        MavenSession session = new MavenSession(container, mgr, new UserModel(), repo,
new DefaultEventDispatcher(), new DefaultLog(container.getLogger()), Collections.EMPTY_LIST);
>            
>            Object value = PluginParameterExpressionEvaluator.evaluate( "#localRepository",
session );
>    
>   
>   
>   
>   1.15      +9 -3      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.14
>   retrieving revision 1.15
>   diff -u -r1.14 -r1.15
>   --- MavenCli.java	7 Mar 2005 23:02:43 -0000	1.14
>   +++ MavenCli.java	8 Mar 2005 06:06:21 -0000	1.15
>   @@ -33,11 +33,13 @@
>    import org.apache.maven.execution.MavenInitializingExecutionRequest;
>    import org.apache.maven.execution.MavenProjectExecutionRequest;
>    import org.apache.maven.execution.MavenReactorExecutionRequest;
>   +import org.apache.maven.model.user.UserModel;
>    import org.apache.maven.monitor.event.DefaultEventDispatcher;
>    import org.apache.maven.monitor.event.DefaultEventMonitor;
>    import org.apache.maven.monitor.event.EventDispatcher;
>    import org.apache.maven.monitor.logging.DefaultLog;
>    import org.apache.maven.plugin.Plugin;
>   +import org.apache.maven.util.UserModelUtils;
>    import org.codehaus.classworlds.ClassWorld;
>    import org.codehaus.plexus.embed.ArtifactEnabledEmbedder;
>    import org.codehaus.plexus.logging.Logger;
>   @@ -117,7 +119,9 @@
>            File projectFile = new File( userDir, POMv4 );
>            
>            EventDispatcher eventDispatcher = new DefaultEventDispatcher();
>   -
>   +        
>   +        UserModel userModel = UserModelUtils.getUserModel();
>   +        
>            if ( projectFile.exists() )
>            {
>                if ( commandLine.hasOption( CLIManager.REACTOR ) )
>   @@ -127,6 +131,7 @@
>                    String excludes = System.getProperty( "maven.reactor.excludes", POMv4
);
>    
>                    request = new MavenReactorExecutionRequest( localRepository,
>   +                                                            userModel,
>                                                                eventDispatcher,
>                                                                mavenProperties,
>                                                                commandLine.getArgList(),
>   @@ -137,6 +142,7 @@
>                else
>                {
>                    request = new MavenProjectExecutionRequest( localRepository,
>   +                                                            userModel,
>                                                                eventDispatcher,
>                                                                mavenProperties,
>                                                                commandLine.getArgList(),
>   @@ -145,7 +151,7 @@
>            }
>            else
>            {
>   -            request = new MavenInitializingExecutionRequest( localRepository, eventDispatcher,
mavenProperties, commandLine.getArgList() );
>   +            request = new MavenInitializingExecutionRequest( localRepository, userModel,
eventDispatcher, mavenProperties, commandLine.getArgList() );
>            }
>    
>            // ----------------------------------------------------------------------
>   
>   
>   
>   1.8       +4 -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.7
>   retrieving revision 1.8
>   diff -u -r1.7 -r1.8
>   --- MavenExecutionRequest.java	4 Mar 2005 09:04:14 -0000	1.7
>   +++ MavenExecutionRequest.java	8 Mar 2005 06:06:22 -0000	1.8
>   @@ -18,6 +18,7 @@
>     */
>    
>    import org.apache.maven.artifact.repository.ArtifactRepository;
>   +import org.apache.maven.model.user.UserModel;
>    import org.apache.maven.monitor.event.EventDispatcher;
>    import org.apache.maven.monitor.event.EventMonitor;
>    import org.apache.maven.monitor.logging.Log;
>   @@ -52,4 +53,6 @@
>        void addEventMonitor( EventMonitor monitor );
>        
>        EventDispatcher getEventDispatcher();
>   +    
>   +    UserModel getUserModel();
>    }
>   
>   
>   
>   1.4       +4 -2      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.3
>   retrieving revision 1.4
>   diff -u -r1.3 -r1.4
>   --- MavenProjectExecutionRequest.java	4 Mar 2005 09:04:14 -0000	1.3
>   +++ MavenProjectExecutionRequest.java	8 Mar 2005 06:06:22 -0000	1.4
>   @@ -18,6 +18,7 @@
>     */
>    
>    import org.apache.maven.artifact.repository.ArtifactRepository;
>   +import org.apache.maven.model.user.UserModel;
>    import org.apache.maven.monitor.event.EventDispatcher;
>    
>    import java.io.File;
>   @@ -35,12 +36,13 @@
>        private File pom;
>    
>        public MavenProjectExecutionRequest( ArtifactRepository localRepository,
>   +                                         UserModel userModel,
>                                             EventDispatcher eventDispatcher,
>                                             Properties properties,
>                                             List goals,
>                                             File pom )
>        {
>   -        super( localRepository, eventDispatcher, properties, goals );
>   +        super( localRepository, userModel, eventDispatcher, properties, goals );
>    
>            this.pom = pom;
>    
>   
>   
>   
>   1.7       +13 -3     maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
>   
>   Index: MavenSession.java
>   ===================================================================
>   RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java,v
>   retrieving revision 1.6
>   retrieving revision 1.7
>   diff -u -r1.6 -r1.7
>   --- MavenSession.java	7 Mar 2005 19:21:38 -0000	1.6
>   +++ MavenSession.java	8 Mar 2005 06:06:22 -0000	1.7
>   @@ -18,6 +18,7 @@
>     */
>    
>    import org.apache.maven.artifact.repository.ArtifactRepository;
>   +import org.apache.maven.model.user.UserModel;
>    import org.apache.maven.monitor.event.EventDispatcher;
>    import org.apache.maven.monitor.logging.Log;
>    import org.apache.maven.plugin.PluginManager;
>   @@ -62,12 +63,16 @@
>    
>        private Log log;
>    
>   -    public MavenSession( PlexusContainer container, PluginManager pluginManager, ArtifactRepository
localRepository,
>   +    private final UserModel userModel;
>   +
>   +    public MavenSession( PlexusContainer container, PluginManager pluginManager, UserModel
userModel, ArtifactRepository localRepository,
>            EventDispatcher eventDispatcher, Log log, List goals )
>        {
>            this.container = container;
>    
>            this.pluginManager = pluginManager;
>   +        
>   +        this.userModel = userModel;
>    
>            this.localRepository = localRepository;
>    
>   @@ -79,7 +84,7 @@
>    
>            this.goals = goals;
>        }
>   -
>   +    
>        public PlexusContainer getContainer()
>        {
>            return container;
>   @@ -143,6 +148,11 @@
>        {
>            return log;
>        }
>   +    
>   +    public UserModel getUserModel()
>   +    {
>   +        return userModel;
>   +    }
>    
>        public void addImpliedExecution( String goal, String implied ) throws CycleDetectedException
>        {
>   
>   
>   
>   1.5       +5 -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.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- MavenReactorExecutionRequest.java	4 Mar 2005 09:04:14 -0000	1.4
>   +++ MavenReactorExecutionRequest.java	8 Mar 2005 06:06:22 -0000	1.5
>   @@ -18,6 +18,7 @@
>     */
>    
>    import org.apache.maven.artifact.repository.ArtifactRepository;
>   +import org.apache.maven.model.user.UserModel;
>    import org.apache.maven.monitor.event.EventDispatcher;
>    import org.apache.maven.project.MavenProject;
>    import org.codehaus.plexus.util.FileUtils;
>   @@ -40,11 +41,11 @@
>    
>        private File baseDirectory;
>    
>   -    public MavenReactorExecutionRequest( ArtifactRepository localRepository, EventDispatcher
eventDispatcher, 
>   +    public MavenReactorExecutionRequest( ArtifactRepository localRepository, UserModel
userModel, EventDispatcher eventDispatcher, 
>                                             Properties properties, List goals, String
includes, 
>                                             String excludes, File baseDirectory )
>        {
>   -        super( localRepository, eventDispatcher, properties, goals );
>   +        super( localRepository, userModel, eventDispatcher, properties, goals );
>    
>            this.includes = includes;
>    
>   @@ -78,6 +79,6 @@
>    
>        public MavenProjectExecutionRequest createProjectExecutionRequest( MavenProject
project )
>        {
>   -        return new MavenProjectExecutionRequest( localRepository, getEventDispatcher(),
parameters, goals, project.getFile() );
>   +        return new MavenProjectExecutionRequest( localRepository, getUserModel(),
getEventDispatcher(), parameters, goals, project.getFile() );
>        }
>    }
>   
>   
>   
>   1.4       +4 -3      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.3
>   retrieving revision 1.4
>   diff -u -r1.3 -r1.4
>   --- MavenInitializingExecutionRequest.java	4 Mar 2005 09:04:14 -0000	1.3
>   +++ MavenInitializingExecutionRequest.java	8 Mar 2005 06:06:22 -0000	1.4
>   @@ -18,6 +18,7 @@
>     */
>    
>    import org.apache.maven.artifact.repository.ArtifactRepository;
>   +import org.apache.maven.model.user.UserModel;
>    import org.apache.maven.monitor.event.EventDispatcher;
>    
>    import java.util.List;
>   @@ -30,9 +31,9 @@
>    public class MavenInitializingExecutionRequest
>    extends AbstractMavenExecutionRequest
>    {
>   -    public MavenInitializingExecutionRequest( ArtifactRepository localRepository,
EventDispatcher eventDispatcher, Properties properties, List goals )
>   +    public MavenInitializingExecutionRequest( ArtifactRepository localRepository,
UserModel userModel, EventDispatcher eventDispatcher, Properties properties, List goals )
>        {
>   -        super( localRepository, eventDispatcher, properties, goals );
>   +        super( localRepository, userModel, eventDispatcher, properties, goals );
>    
>            type = "initializing";
>        }
>   
>   
>   
>   1.9       +12 -3     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.8
>   retrieving revision 1.9
>   diff -u -r1.8 -r1.9
>   --- AbstractMavenExecutionRequest.java	4 Mar 2005 09:04:14 -0000	1.8
>   +++ AbstractMavenExecutionRequest.java	8 Mar 2005 06:06:22 -0000	1.9
>   @@ -18,7 +18,7 @@
>     */
>    
>    import org.apache.maven.artifact.repository.ArtifactRepository;
>   -import org.apache.maven.monitor.event.DefaultEventDispatcher;
>   +import org.apache.maven.model.user.UserModel;
>    import org.apache.maven.monitor.event.EventDispatcher;
>    import org.apache.maven.monitor.event.EventMonitor;
>    import org.apache.maven.monitor.logging.Log;
>   @@ -48,9 +48,13 @@
>        
>        private EventDispatcher eventDispatcher;
>    
>   -    public AbstractMavenExecutionRequest( ArtifactRepository localRepository, EventDispatcher
eventDispatcher, Properties parameters, List goals )
>   +    private final UserModel userModel;
>   +
>   +    public AbstractMavenExecutionRequest( ArtifactRepository localRepository, UserModel
userModel, EventDispatcher eventDispatcher, Properties parameters, List goals )
>        {
>            this.localRepository = localRepository;
>   +        
>   +        this.userModel = userModel;
>    
>            this.parameters = parameters;
>    
>   @@ -58,6 +62,11 @@
>            
>            this.eventDispatcher = eventDispatcher;
>        }
>   +    
>   +    public UserModel getUserModel()
>   +    {
>   +        return userModel;
>   +    }
>    
>        public ArtifactRepository getLocalRepository()
>        {
>   
>   
>   
>   1.9       +1 -0      maven-components/.cvsignore
>   
>   Index: .cvsignore
>   ===================================================================
>   RCS file: /home/cvs/maven-components/.cvsignore,v
>   retrieving revision 1.8
>   retrieving revision 1.9
>   diff -u -r1.8 -r1.9
>   --- .cvsignore	7 Mar 2005 18:12:03 -0000	1.8
>   +++ .cvsignore	8 Mar 2005 06:06:22 -0000	1.9
>   @@ -7,3 +7,4 @@
>    .settings
>    mboot.jar
>    dummy
>   +build.ajproperties
>   
>   
>   
>   1.3       +2 -2      maven-components/maven-core/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java
>   
>   Index: RegexBasedModelInterpolator.java
>   ===================================================================
>   RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java,v
>   retrieving revision 1.2
>   retrieving revision 1.3
>   diff -u -r1.2 -r1.3
>   --- RegexBasedModelInterpolator.java	23 Feb 2005 03:56:24 -0000	1.2
>   +++ RegexBasedModelInterpolator.java	8 Mar 2005 06:06:22 -0000	1.3
>   @@ -38,7 +38,7 @@
>        implements ModelInterpolator
>    {
>    
>   -    private static final Pattern EXPRESSION_PATTERN = Pattern.compile( "\\$\\{([^}]+)\\}"
);
>   +    private static final Pattern EXPRESSION_PATTERN = Pattern.compile( "\\$\\{(pom|project\\.)?([^}]+)\\}"
);
>    
>        /**
>         * Added: Feb 3, 2005 by jdcasey
>   @@ -87,7 +87,7 @@
>            while ( matcher.find() )
>            {
>                String wholeExpr = matcher.group( 0 );
>   -            String realExpr = matcher.group( 1 );
>   +            String realExpr = matcher.group( 2 );
>    
>                String value = null;
>                try
>   
>   
>   
>   1.1                  maven-components/maven-core/src/main/java/org/apache/maven/util/UserModelUtils.java
>   
>   Index: UserModelUtils.java
>   ===================================================================
>   package org.apache.maven.util;
>   
>   import org.apache.maven.model.user.JdkProfile;
>   import org.apache.maven.model.user.MavenProfile;
>   import org.apache.maven.model.user.ServerProfile;
>   import org.apache.maven.model.user.UserModel;
>   import org.apache.maven.model.user.io.xpp3.MavenUserModelXpp3Reader;
>   import org.apache.maven.model.user.io.xpp3.MavenUserModelXpp3Writer;
>   
>   import java.io.File;
>   import java.io.FileReader;
>   import java.io.FileWriter;
>   import java.io.IOException;
>   import java.util.Iterator;
>   import java.util.List;
>   
>   /**
>    * @author jdcasey
>    */
>   public final class UserModelUtils
>   {
>   
>       public static final String JDK_PROFILE_ENVAR = "maven.jdkVersion";
>   
>       public static final String MAVEN_PROFILE_ENVAR = "maven.mavenProfileId";
>   
>       public static final String SERVER_PROFILE_ENVAR = "maven.serverProfileId";
>   
>       private static final String USER_MODEL_LOCATION = "/.m2/user.xml";
>   
>       private UserModelUtils()
>       {
>       }
>   
>       public static ServerProfile getActiveServer( UserModel userModel )
>       {
>           List servers = userModel.getServerProfiles();
>   
>           String serverId = System.getProperty( SERVER_PROFILE_ENVAR );
>           if ( serverId == null || serverId.trim().length() < 1 )
>           {
>               serverId = userModel.getDefaultProfiles().getServerProfileId();
>           }
>   
>           ServerProfile active = null;
>           for ( Iterator it = servers.iterator(); it.hasNext(); )
>           {
>               ServerProfile server = (ServerProfile) it.next();
>               if ( serverId.equals( server.getId() ) )
>               {
>                   active = server;
>                   break;
>               }
>           }
>   
>           return active;
>       }
>   
>       public static JdkProfile getActiveJdk( UserModel userModel )
>       {
>           List jdks = userModel.getJdkProfiles();
>   
>           String jdkId = System.getProperty( JDK_PROFILE_ENVAR );
>           if ( jdkId == null || jdkId.trim().length() < 1 )
>           {
>               jdkId = userModel.getDefaultProfiles().getJdkVersion();
>           }
>   
>           JdkProfile active = null;
>           for ( Iterator it = jdks.iterator(); it.hasNext(); )
>           {
>               JdkProfile jdk = (JdkProfile) it.next();
>               if ( jdkId.equals( jdk.getVersion() ) )
>               {
>                   active = jdk;
>                   break;
>               }
>           }
>   
>           return active;
>       }
>   
>       public static MavenProfile getActiveRuntimeProfile( UserModel userModel )
>       {
>           List mavenProfiles = userModel.getMavenProfiles();
>   
>           String mavenProfileId = System.getProperty( MAVEN_PROFILE_ENVAR );
>           if ( mavenProfileId == null || mavenProfileId.trim().length() < 1 )
>           {
>               mavenProfileId = userModel.getDefaultProfiles().getMavenProfileId();
>           }
>   
>           MavenProfile active = null;
>           for ( Iterator it = mavenProfiles.iterator(); it.hasNext(); )
>           {
>               MavenProfile mavenProfile = (MavenProfile) it.next();
>               if ( mavenProfileId.equals( mavenProfile.getId() ) )
>               {
>                   active = mavenProfile;
>                   break;
>               }
>           }
>   
>           return active;
>       }
>   
>       // TODO: don't throw Exception.
>       public static UserModel getUserModel() throws Exception
>       {
>           UserModel model = null;
>   
>           File modelFile = getUserModelFile();
>           if ( modelFile.exists() && modelFile.isFile() )
>           {
>               MavenUserModelXpp3Reader modelReader = new MavenUserModelXpp3Reader();
>               FileReader reader = null;
>               try
>               {
>                   reader = new FileReader( modelFile );
>   
>                   model = modelReader.read( reader );
>               }
>               finally
>               {
>                   if ( reader != null )
>                   {
>                       try
>                       {
>                           reader.close();
>                       }
>                       catch ( IOException e )
>                       {
>                       }
>                   }
>               }
>           }
>   
>           return model;
>       }
>   
>       // TODO: don't throw Exception.
>       public static void setUserModel( UserModel userModel ) throws Exception
>       {
>           File modelFile = getUserModelFile();
>   
>           File modelDir = modelFile.getParentFile();
>           if ( !modelDir.exists() )
>           {
>               modelDir.mkdirs();
>           }
>   
>           MavenUserModelXpp3Writer modelWriter = new MavenUserModelXpp3Writer();
>   
>           FileWriter writer = null;
>           try
>           {
>               writer = new FileWriter( modelFile );
>   
>               modelWriter.write( writer, userModel );
>   
>               writer.flush();
>           }
>           finally
>           {
>               if ( writer != null )
>               {
>                   try
>                   {
>                       writer.close();
>                   }
>                   catch ( IOException e )
>                   {
>                   }
>               }
>           }
>   
>       }
>   
>       private static File getUserModelFile()
>       {
>           String userDir = System.getProperty( "user.home" );
>   
>           String modelPath = userDir + USER_MODEL_LOCATION;
>   
>           modelPath = modelPath.replaceAll( "\\\\", "/" );
>           modelPath = modelPath.replaceAll( "//", "/" );
>   
>           File userModelFile = new File( modelPath );
>   
>           return userModelFile;
>       }
>   
>   }
>   
>   
>   1.20      +5 -0      maven-components/maven-core/pom.xml
>   
>   Index: pom.xml
>   ===================================================================
>   RCS file: /home/cvs/maven-components/maven-core/pom.xml,v
>   retrieving revision 1.19
>   retrieving revision 1.20
>   diff -u -r1.19 -r1.20
>   --- pom.xml	4 Mar 2005 09:04:20 -0000	1.19
>   +++ pom.xml	8 Mar 2005 06:06:22 -0000	1.20
>   @@ -33,6 +33,11 @@
>        </dependency>
>        <dependency>
>          <groupId>maven</groupId>
>   +      <artifactId>maven-user-model</artifactId>
>   +      <version>2.0-SNAPSHOT</version>
>   +    </dependency>
>   +    <dependency>
>   +      <groupId>maven</groupId>
>          <artifactId>maven-artifact</artifactId>
>          <version>2.0-SNAPSHOT</version>
>        </dependency>
>   
>   
>   
>   1.24      +2 -1      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.23
>   retrieving revision 1.24
>   diff -u -r1.23 -r1.24
>   --- DefaultMaven.java	7 Mar 2005 19:03:19 -0000	1.23
>   +++ DefaultMaven.java	8 Mar 2005 06:06:22 -0000	1.24
>   @@ -267,6 +267,7 @@
>        {
>            return new MavenSession( container,
>                                     pluginManager,
>   +                                 request.getUserModel(),
>                                     request.getLocalRepository(),
>                                     request.getEventDispatcher(),
>                                     request.getLog(),
>   
>   
>   
> 
> 

Mime
View raw message