maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r689746 - in /maven/components/branches/maven-2.1.x-MNG-624: ./ maven-core/src/main/java/org/apache/maven/ maven-core/src/main/java/org/apache/maven/lifecycle/ maven-core/src/main/java/org/apache/maven/monitor/event/ maven-core/src/main/jav...
Date Thu, 28 Aug 2008 07:35:06 GMT
Author: rgoers
Date: Thu Aug 28 00:35:05 2008
New Revision: 689746

URL: http://svn.apache.org/viewvc?rev=689746&view=rev
Log:
Fix for MNG-624 for testing

Added:
    maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/monitor/event/ProjectEventMonitor.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/MavenEvent.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/
    maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/DefaultModelTransformer.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/ModelItem.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/ModelTransformationException.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/ModelTransformer.java
Modified:
    maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/monitor/event/DefaultEventMonitor.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/AbstractSelectiveEventMonitor.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/DefaultEventDispatcher.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/EventDispatcher.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/EventMonitor.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java
    maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/resources/META-INF/plexus/components.xml
    maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/test/resources/org/apache/maven/project/ProjectClasspathTest.xml
    maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/test/resources/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.xml
    maven/components/branches/maven-2.1.x-MNG-624/pom.xml

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Thu Aug 28 00:35:05 2008
@@ -37,6 +37,8 @@
 import org.apache.maven.monitor.event.DefaultEventDispatcher;
 import org.apache.maven.monitor.event.EventDispatcher;
 import org.apache.maven.monitor.event.MavenEvents;
+import org.apache.maven.monitor.event.ProjectEventMonitor;
+import org.apache.maven.monitor.event.MavenEvent;
 import org.apache.maven.profiles.ProfileManager;
 import org.apache.maven.profiles.activation.ProfileActivationException;
 import org.apache.maven.project.DuplicateProjectException;
@@ -119,8 +121,10 @@
 //        }
 
         EventDispatcher dispatcher = request.getEventDispatcher();
+        
+        request.addEventMonitor( new ProjectEventMonitor( projectBuilder ) );
 
-        String event = MavenEvents.REACTOR_EXECUTION;
+        MavenEvent event = new MavenEvent(MavenEvents.REACTOR_EXECUTION, request);
 
         dispatcher.dispatchStart( event, request.getBaseDirectory() );
 

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java Thu Aug 28 00:35:05 2008
@@ -49,6 +49,7 @@
 import org.apache.maven.model.ReportSet;
 import org.apache.maven.monitor.event.EventDispatcher;
 import org.apache.maven.monitor.event.MavenEvents;
+import org.apache.maven.monitor.event.MavenEvent;
 import org.apache.maven.plugin.InvalidPluginException;
 import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -246,7 +247,7 @@
 
                     // !! This is ripe for refactoring to an aspect.
                     // Event monitoring.
-                    String event = MavenEvents.PROJECT_EXECUTION;
+                    MavenEvent event = new MavenEvent(MavenEvents.PROJECT_EXECUTION, rootProject);
 
                     long buildStartTime = System.currentTimeMillis();
 
@@ -312,7 +313,7 @@
 
                         // !! This is ripe for refactoring to an aspect.
                         // Event monitoring.
-                        String event = MavenEvents.PROJECT_EXECUTION;
+                        MavenEvent event = new MavenEvent(MavenEvents.PROJECT_EXECUTION, currentProject);
 
                         long buildStartTime = System.currentTimeMillis();
 
@@ -360,7 +361,7 @@
     }
 
     private void executeGoalAndHandleFailures( String task, MavenSession session, MavenProject project,
-                                               EventDispatcher dispatcher, String event, ReactorManager rm,
+                                               EventDispatcher dispatcher, MavenEvent event, ReactorManager rm,
                                                long buildStartTime, String target )
         throws BuildFailureException, LifecycleExecutionException
     {

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/monitor/event/DefaultEventMonitor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/monitor/event/DefaultEventMonitor.java?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/monitor/event/DefaultEventMonitor.java (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/monitor/event/DefaultEventMonitor.java Thu Aug 28 00:35:05 2008
@@ -39,7 +39,7 @@
         this.logger = logger;
     }
 
-    protected void doStartEvent( String event, String target, long time )
+    protected void doStartEvent( MavenEvent event, String target, long time )
     {
         logger.info( "[" + target + "]" );
     }

Added: maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/monitor/event/ProjectEventMonitor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/monitor/event/ProjectEventMonitor.java?rev=689746&view=auto
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/monitor/event/ProjectEventMonitor.java (added)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/monitor/event/ProjectEventMonitor.java Thu Aug 28 00:35:05 2008
@@ -0,0 +1,62 @@
+package org.apache.maven.monitor.event;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.codehaus.plexus.logging.Logger;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Notifies the ProjectBuilder of events.
+ */
+public class ProjectEventMonitor
+    extends AbstractSelectiveEventMonitor
+{
+
+    private static final String[] EVENTS = {MavenEvents.MOJO_EXECUTION};
+
+    private MavenProjectBuilder builder;
+
+    public ProjectEventMonitor( MavenProjectBuilder builder )
+    {
+        super( EVENTS, EVENTS, MavenEvents.NO_EVENTS );
+
+        this.builder = builder;
+    }
+
+    protected void doStartEvent( MavenEvent event, String target, long time )
+    {
+        Object obj = event.getSource();
+        if ( !target.startsWith( "clean") && obj != null && obj instanceof MavenProject )
+        {
+            builder.prepareProject((MavenProject)obj);
+        }
+    }
+
+    protected void doEndEvent( MavenEvent event, String target, long timestamp )
+    {
+        Object obj = event.getSource();
+        if ( target.startsWith( "clean") && obj != null && obj instanceof MavenProject )
+        {
+            builder.cleanProject((MavenProject)obj);
+        }
+    }
+
+}
\ No newline at end of file

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Thu Aug 28 00:35:05 2008
@@ -42,6 +42,7 @@
 import org.apache.maven.model.ReportPlugin;
 import org.apache.maven.monitor.event.EventDispatcher;
 import org.apache.maven.monitor.event.MavenEvents;
+import org.apache.maven.monitor.event.MavenEvent;
 import org.apache.maven.monitor.logging.DefaultLog;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.Parameter;
@@ -433,10 +434,9 @@
             dom = Xpp3Dom.mergeXpp3Dom( dom, mojoExecution.getConfiguration() );
         }
 
-        plugin = getConfiguredMojo( session, dom, project, false, mojoExecution );
-
         // Event monitoring.
-        String event = MavenEvents.MOJO_EXECUTION;
+        MavenEvent event = new MavenEvent(MavenEvents.MOJO_EXECUTION, project);
+        
         EventDispatcher dispatcher = session.getEventDispatcher();
 
         String goalExecId = goalName;
@@ -448,6 +448,8 @@
 
         dispatcher.dispatchStart( event, goalExecId );
 
+        plugin = getConfiguredMojo( session, dom, project, false, mojoExecution );
+
         ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
 
         try

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java Thu Aug 28 00:35:05 2008
@@ -92,12 +92,12 @@
 
         if ( project != null )
         {
-            File projectFile = project.getFile();
+            File file = project.getBasedir();
 
             // this should always be the case for non-super POM instances...
-            if ( projectFile != null )
+            if ( file != null )
             {
-                basedir = projectFile.getParentFile().getAbsolutePath();
+                basedir = file.getAbsolutePath();
             }
         }
 
@@ -349,9 +349,9 @@
     {
         File basedir;
 
-        if ( project != null && project.getFile() != null )
+        if ( project != null && project.getBasedir() != null )
         {
-            basedir = project.getFile().getParentFile();
+            basedir = project.getBasedir();
         }
         else
         {

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/AbstractSelectiveEventMonitor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/AbstractSelectiveEventMonitor.java?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/AbstractSelectiveEventMonitor.java (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/AbstractSelectiveEventMonitor.java Thu Aug 28 00:35:05 2008
@@ -29,9 +29,9 @@
     implements EventMonitor
 {
     
-    private List boundStartEvents;
-    private List boundErrorEvents;
-    private List boundEndEvents;
+    private List<String> boundStartEvents;
+    private List<String> boundErrorEvents;
+    private List<String> boundEndEvents;
 
     protected AbstractSelectiveEventMonitor(String[] startEvents, String[] endEvents, String[] errorEvents)
     {
@@ -42,39 +42,39 @@
         this.boundErrorEvents = Arrays.asList( errorEvents );
     }
 
-    public final void startEvent( String eventName, String target, long timestamp )
+    public final void startEvent( MavenEvent event, String target, long timestamp )
     {
-        if( boundStartEvents.contains( eventName ) )
+        if( boundStartEvents.contains( event.toString()) )
         {
-            doStartEvent( eventName, target, timestamp );
+            doStartEvent( event, target, timestamp );
         }
     }
     
-    protected void doStartEvent( String eventName, String target, long timestamp )
+    protected void doStartEvent( MavenEvent event, String target, long timestamp )
     {
     }
 
-    public final void endEvent( String eventName, String target, long timestamp )
+    public final void endEvent( MavenEvent event, String target, long timestamp )
     {
-        if( boundEndEvents.contains( eventName ) )
+        if( boundEndEvents.contains( event.toString() ) )
         {
-            doEndEvent( eventName, target, timestamp );
+            doEndEvent( event, target, timestamp );
         }
     }
 
-    protected void doEndEvent( String eventName, String target, long timestamp )
+    protected void doEndEvent( MavenEvent event, String target, long timestamp )
     {
     }
 
-    public final void errorEvent( String eventName, String target, long timestamp, Throwable cause )
+    public final void errorEvent( MavenEvent event, String target, long timestamp, Throwable cause )
     {
-        if( boundErrorEvents.contains( eventName ) )
+        if( boundErrorEvents.contains( event.toString() ) )
         {
-            doErrorEvent( eventName, target, timestamp, cause );
+            doErrorEvent( event, target, timestamp, cause );
         }
     }
 
-    protected void doErrorEvent( String eventName, String target, long timestamp, Throwable cause )
+    protected void doErrorEvent( MavenEvent event, String target, long timestamp, Throwable cause )
     {
     }
 

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/DefaultEventDispatcher.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/DefaultEventDispatcher.java?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/DefaultEventDispatcher.java (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/DefaultEventDispatcher.java Thu Aug 28 00:35:05 2008
@@ -37,7 +37,7 @@
         eventMonitors.add( monitor );
     }
 
-    public void dispatchStart( String event, String target )
+    public void dispatchStart( MavenEvent event, String target )
     {
         for ( Iterator it = eventMonitors.iterator(); it.hasNext(); )
         {
@@ -46,7 +46,7 @@
         }
     }
 
-    public void dispatchEnd( String event, String target )
+    public void dispatchEnd( MavenEvent event, String target )
     {
         for ( Iterator it = eventMonitors.iterator(); it.hasNext(); )
         {
@@ -55,7 +55,7 @@
         }
     }
 
-    public void dispatchError( String event, String target, Throwable cause )
+    public void dispatchError( MavenEvent event, String target, Throwable cause )
     {
         for ( Iterator it = eventMonitors.iterator(); it.hasNext(); )
         {

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/EventDispatcher.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/EventDispatcher.java?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/EventDispatcher.java (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/EventDispatcher.java Thu Aug 28 00:35:05 2008
@@ -27,10 +27,10 @@
 
     void addEventMonitor( EventMonitor monitor );
 
-    void dispatchStart( String event, String target );
+    void dispatchStart( MavenEvent event, String target );
 
-    void dispatchEnd( String event, String target );
+    void dispatchEnd( MavenEvent event, String target );
 
-    void dispatchError( String event, String target, Throwable cause );
+    void dispatchError( MavenEvent event, String target, Throwable cause );
 
 }
\ No newline at end of file

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/EventMonitor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/EventMonitor.java?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/EventMonitor.java (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/EventMonitor.java Thu Aug 28 00:35:05 2008
@@ -25,10 +25,10 @@
 public interface EventMonitor
 {
 
-    void startEvent( String eventName, String target, long timestamp );
+    void startEvent( MavenEvent event, String target, long timestamp );
     
-    void endEvent( String eventName, String target, long timestamp );
+    void endEvent( MavenEvent event, String target, long timestamp );
     
-    void errorEvent( String eventName, String target, long timestamp, Throwable cause ); 
+    void errorEvent( MavenEvent event, String target, long timestamp, Throwable cause );
 
 }
\ No newline at end of file

Added: maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/MavenEvent.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/MavenEvent.java?rev=689746&view=auto
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/MavenEvent.java (added)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-monitor/src/main/java/org/apache/maven/monitor/event/MavenEvent.java Thu Aug 28 00:35:05 2008
@@ -0,0 +1,55 @@
+package org.apache.maven.monitor.event;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ import java.util.EventObject;
+
+/**
+ *  Represents events that occur during the build.
+ */
+public class MavenEvent extends EventObject
+{
+    private final String eventType;
+
+    /**
+     * Construct the MavenEvent.
+     * @param type The type of the event. See MavenEvents.
+     * @param source The Event Source (See java.util.EventObject.
+     */
+    public MavenEvent(String type, Object source)
+    {
+        super(source);
+        this.eventType = type;
+    }
+
+    /**
+     * @return the Event type.
+     */
+    public String getEventType()
+    {
+        return this.eventType;
+    }
+
+    /**
+     * @return the Event type.
+     */
+    public String toString()
+    {
+        return this.eventType;
+    }
+}

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java Thu Aug 28 00:35:05 2008
@@ -65,6 +65,7 @@
 import org.apache.maven.project.injection.ProfileInjector;
 import org.apache.maven.project.interpolation.ModelInterpolationException;
 import org.apache.maven.project.interpolation.ModelInterpolator;
+import org.apache.maven.project.transformation.ModelTransformer;
 import org.apache.maven.project.path.PathTranslator;
 import org.apache.maven.project.validation.ModelValidationResult;
 import org.apache.maven.project.validation.ModelValidator;
@@ -160,9 +161,11 @@
 
     private ModelValidator validator;
 
-    private Map rawProjectCache = new HashMap();
+    private Map<String, MavenProject> rawProjectCache = new HashMap<String, MavenProject>();
 
-    private Map processedProjectCache = new HashMap();
+    private Map<String, MavenProject> processedProjectCache = new HashMap<String, MavenProject>();
+
+    private Map<String, MavenProject> fileProjectCache = new HashMap<String, MavenProject>();
 
     // TODO: make it a component
     private MavenXpp3Reader modelReader;
@@ -173,8 +176,12 @@
 
     private ModelInterpolator modelInterpolator;
 
+    private ModelTransformer modelTransformer;
+
     private ArtifactRepositoryFactory artifactRepositoryFactory;
 
+    private boolean prepared = false;
+
     // ----------------------------------------------------------------------
     // I am making this available for use with a new method that takes a
     // a monitor wagon monitor as a parameter so that tools can use the
@@ -185,11 +192,66 @@
 
     public static final String MAVEN_MODEL_VERSION = "4.0.0";
 
+    private static final String PARENT_PATTERN = "\\$\\{(.+?)\\}";
+
     public void initialize()
     {
         modelReader = new MavenXpp3Reader();
     }
 
+    /**
+     * Called by the event dispatcher, transforms the project file so it can be stored into a repository
+     * by replacing any variables in the fields that identify the artifact or its parent.
+     * @param project The MavenProject to transform.
+     */
+    public void prepareProject(MavenProject project)
+    {
+        if (project.isPrepared())
+        {
+            return;
+        }
+        getLogger().debug("Preparing project " + project.getId());
+        Build build = project.getBuild();
+        File projectDescriptor = project.getFile();
+        if (projectDescriptor == null)
+        {
+            return;
+        }
+        File projectDir = project.getBasedir();
+        Model model = project.getModel();
+        String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() );
+        // If the parent version was replaced write the pom to the build directory
+        // and use that file descriptor.
+        String directory = pathTranslator.alignToBaseDirectory(build.getDirectory(), projectDir);
+        File target = new File(directory, projectDescriptor.getName());
+        if ( modelTransformer.transformModel(projectDescriptor, target, project, projectId, false) )
+        {
+            // The model was updated and written to the target directory.
+            if ( project.getOriginalFile() == null )
+            {
+                project.setOriginalFile( projectDescriptor );
+                project.setBasedir(projectDescriptor.getParentFile());
+            }
+            project.setFile( target );
+        }
+        project.setPrepared(true);
+    }
+
+    /**
+     * Called by the event dispatcher, marks the project as "not prepared" - the target directory has
+     * been cleaned.
+     * @param project The MavenProject.
+     */
+    public void cleanProject(MavenProject project)
+    {
+        getLogger().debug("Cleaning project " + project.getId());
+        if (project.isPrepared())
+        {
+            project.setFile( project.getOriginalFile() );
+            project.setPrepared(false);
+        }
+    }
+
     // ----------------------------------------------------------------------
     // MavenProjectBuilder Implementation
     // ----------------------------------------------------------------------
@@ -242,7 +304,7 @@
     {
         String cacheKey = createCacheKey( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() );
 
-        MavenProject project = (MavenProject) processedProjectCache.get( cacheKey );
+        MavenProject project = processedProjectCache.get( cacheKey );
 
         if ( project != null )
         {
@@ -906,6 +968,14 @@
 
             // Only track the file of a POM in the source tree
             project.setFile( projectDescriptor );
+            try
+            {
+                fileProjectCache.put( projectDescriptor.getCanonicalPath(), project );
+            }
+            catch (Exception ex)
+            {
+                // Ignore the exception. It just won't be cached.
+            }
         }
 
 //        try
@@ -1053,7 +1123,7 @@
                                               parentProject.getArtifactId(),
                                               parentProject.getVersion() );
 
-            MavenProject processedParent = (MavenProject) processedProjectCache.get( cacheKey );
+            MavenProject processedParent = processedProjectCache.get( cacheKey );
             Artifact parentArtifact;
 
             // yeah, this null check might be a bit paranoid, but better safe than sorry...
@@ -1246,19 +1316,24 @@
                 throw new ProjectBuildingException( projectId,
                                                     "Parent element is a duplicate of " + "the current project " );
             }
-            else if ( StringUtils.isEmpty( parentModel.getVersion() ) )
-            {
-                throw new ProjectBuildingException( projectId, "Missing version element from parent element" );
-            }
 
             // the only way this will have a value is if we find the parent on disk...
             File parentDescriptor = null;
 
             model = null;
 
+            resolveParent(parentModel, project, projectId, projectDir, config, strict);
+
+            if ( StringUtils.isEmpty( parentModel.getVersion() ) )
+            {
+                throw new ProjectBuildingException( projectId, "Missing version element from parent element" );
+            }
+            
+            String parentRelativePath = parentModel.getRelativePath();
+
             String parentKey =
                 createCacheKey( parentModel.getGroupId(), parentModel.getArtifactId(), parentModel.getVersion() );
-            MavenProject parentProject = (MavenProject) rawProjectCache.get( parentKey );
+            MavenProject parentProject = rawProjectCache.get( parentKey );
 
             if ( parentProject != null )
             {
@@ -1267,92 +1342,17 @@
                 parentDescriptor = parentProject.getFile();
             }
 
-            String parentRelativePath = parentModel.getRelativePath();
-
-            // if we can't find a cached model matching the parent spec, then let's try to look on disk using
-            // <relativePath/>
-            if ( ( model == null ) && ( projectDir != null ) && StringUtils.isNotEmpty( parentRelativePath ) )
+            if ((model == null) && (projectDir != null) && StringUtils.isNotEmpty(parentRelativePath))
             {
-                parentDescriptor = new File( projectDir, parentRelativePath );
-
-                if ( getLogger().isDebugEnabled() )
+                getLogger().debug("Checking relative path " + parentRelativePath + " for " +
+                           parentModel.getGroupId() + "." + parentModel.getArtifactId());
+                // if we can't find a cached model matching the parent spec, then let's try to look on disk using
+                // <relativePath/>
+                ModelWithFile mwf = getParentFromRelativePath(parentModel, projectDir, project, projectId, strict, false);
+                if (mwf != null)
                 {
-                    getLogger().debug( "Searching for parent-POM: " + parentModel.getId() + " of project: " +
-                        project.getId() + " in relative path: " + parentRelativePath );
-                }
-
-                if ( parentDescriptor.isDirectory() )
-                {
-                    if ( getLogger().isDebugEnabled() )
-                    {
-                        getLogger().debug( "Path specified in <relativePath/> (" + parentRelativePath +
-                            ") is a directory. Searching for 'pom.xml' within this directory." );
-                    }
-
-                    parentDescriptor = new File( parentDescriptor, "pom.xml" );
-
-                    if ( !parentDescriptor.exists() )
-                    {
-                        if ( getLogger().isDebugEnabled() )
-                        {
-                            getLogger().debug( "Parent-POM: " + parentModel.getId() + " for project: " +
-                                project.getId() + " cannot be loaded from relative path: " + parentDescriptor +
-                                "; path does not exist." );
-                        }
-                    }
-                }
-
-                if ( parentDescriptor != null )
-                {
-                    try
-                    {
-                        parentDescriptor = parentDescriptor.getCanonicalFile();
-                    }
-                    catch ( IOException e )
-                    {
-                        getLogger().debug( "Failed to canonicalize potential parent POM: \'" + parentDescriptor + "\'",
-                                           e );
-
-                        parentDescriptor = null;
-                    }
-                }
-
-                if ( ( parentDescriptor != null ) && parentDescriptor.exists() )
-                {
-                    Model candidateParent = readModel( projectId, parentDescriptor, strict );
-
-                    String candidateParentGroupId = candidateParent.getGroupId();
-                    if ( ( candidateParentGroupId == null ) && ( candidateParent.getParent() != null ) )
-                    {
-                        candidateParentGroupId = candidateParent.getParent().getGroupId();
-                    }
-
-                    String candidateParentVersion = candidateParent.getVersion();
-                    if ( ( candidateParentVersion == null ) && ( candidateParent.getParent() != null ) )
-                    {
-                        candidateParentVersion = candidateParent.getParent().getVersion();
-                    }
-
-                    if ( parentModel.getGroupId().equals( candidateParentGroupId ) &&
-                        parentModel.getArtifactId().equals( candidateParent.getArtifactId() ) &&
-                        parentModel.getVersion().equals( candidateParentVersion ) )
-                    {
-                        model = candidateParent;
-
-                        getLogger().debug( "Using parent-POM from the project hierarchy at: \'" +
-                            parentModel.getRelativePath() + "\' for project: " + project.getId() );
-                    }
-                    else
-                    {
-                        getLogger().debug( "Invalid parent-POM referenced by relative path '" +
-                            parentModel.getRelativePath() + "' in parent specification in " + project.getId() + ":" +
-                            "\n  Specified: " + parentModel.getId() + "\n  Found:     " + candidateParent.getId() );
-                    }
-                }
-                else if ( getLogger().isDebugEnabled() )
-                {
-                    getLogger().debug(
-                        "Parent-POM: " + parentModel.getId() + " not found in relative path: " + parentRelativePath );
+                    model = mwf.model;
+                    parentDescriptor = mwf.parentDescriptor;
                 }
             }
 
@@ -1427,11 +1427,244 @@
             project.setParentArtifact( parentArtifact );
         }
 
-        rawProjectCache.put( createCacheKey( project.getGroupId(), project.getArtifactId(), project.getVersion() ), new MavenProject( project ) );
+        MavenProject cachedProject = new MavenProject( project );
+        modelTransformer.resolveModel( cachedProject.getModel(), projectId, config );
+
+        rawProjectCache.put( createCacheKey( cachedProject.getGroupId(), cachedProject.getArtifactId(),
+                                             cachedProject.getVersion() ), cachedProject );
 
         return project;
     }
 
+    /*
+     * If the project has a parent make sure the parent version is resolved. The version is obtained by
+     * 1. Resolving any variables provided via system properties (variables from parents won't be found since
+     *    the parent isn't known.
+     * 2. Looking in the file cache for the resolved parent project using the relative location as the key.
+     * 3. Looking for the parent at the relative path on disk.
+     *    a. The target directory at the relative path is inspected for a modified pom.
+     *    b. The project at the relative path is used.
+     * If at the end of this a resolved parent version is not located throw an Exception. Do not try to recurse
+     * to further parents.
+     */
+    private void resolveParent( Parent parentModel,
+                                MavenProject project,
+                                String projectId,
+                                File projectDir,
+                                ProjectBuilderConfiguration config,
+                                boolean strict )
+        throws ProjectBuildingException
+    {
+        String parentRelativePath = parentModel.getRelativePath();
+        String origParentVersion = parentModel.getVersion();
+        Model originalModel = project.getOriginalModel();
+
+        if ( origParentVersion == null || origParentVersion.matches( PARENT_PATTERN ) )
+        {
+            getLogger().debug( "resolving parent version for project " + projectId );
+            Model updatedModel = ModelUtils.cloneModel( originalModel );
+
+            try
+            {
+                modelTransformer.resolveModel( updatedModel, projectId, config );
+            }
+            catch ( Exception ex )
+            {
+                // If it fails just get the parent from the relative path.
+            }
+            String version = updatedModel.getParent().getVersion();
+            String relativePathText = "";
+            if ( version != null && !version.equals( origParentVersion ) )
+            {
+                parentModel.setVersion( version );
+            }
+            else if ( ( projectDir != null ) && StringUtils.isNotEmpty( parentRelativePath ) )
+            {
+                File parentDescriptor = new File(projectDir, parentRelativePath);
+                String parentPath = null;
+                MavenProject parentProject = null;
+                try
+                {
+                    parentPath = parentDescriptor.getCanonicalPath();
+                    parentProject = fileProjectCache.get( parentPath );
+                }
+                catch(Exception ex)
+                {
+                    // Ignore the error. We just won't find the version this way.
+                }
+
+                if (parentProject != null)
+                {
+                    getLogger().debug( "parent version set to " + version);
+                    parentModel.setVersion( parentProject.getVersion() );
+                    return;
+                }
+                // It isn't being built in this maven execution. Try to get it from disk.
+                Model pModel = getParentFromRelativePath( parentModel,
+                                                          projectDir,
+                                                          project,
+                                                          projectId,
+                                                          strict,
+                                                          true ).model;
+                if ( pModel != null )
+                {
+                    try
+                    {
+                        modelTransformer.resolveModel( pModel, projectId, config );
+                    }
+                    catch ( Exception ex )
+                    {
+                        // Ignore the failure.
+                    }
+                    version = pModel.getVersion();
+                    if (version != null && !version.matches( PARENT_PATTERN ))
+                    {
+                        getLogger().debug( "parent version set to " + version);
+                        parentModel.setVersion( version );
+                    }
+                    else
+                    {
+                        getLogger().debug(" Did not determine parent version" );
+                        // The version isn't in the parent. It is either inherited from its parent of is a variable.
+
+                    }
+                }
+                else
+                {
+                    relativePathText = " and parent could not be located at relative path " + parentRelativePath;
+                }
+            }
+            if ( version == origParentVersion )
+            {
+                throw new ProjectBuildingException( projectId, "Parent version property " + origParentVersion +
+                    " is not defined" + relativePathText );
+            }
+        }
+    }
+
+    private class ModelWithFile
+    {
+        public final Model model;
+        public final File parentDescriptor;
+
+        public ModelWithFile(Model model, File descriptor)
+        {
+            this.model = model;
+            this.parentDescriptor = descriptor;
+        }
+    }
+
+    /*
+     * Retrieve the parent Model along with its File descriptor.
+     */
+    private ModelWithFile getParentFromRelativePath(Parent parentModel, File projectDir, MavenProject project,
+                                            String projectId, boolean strict, boolean useTarget )
+            throws ProjectBuildingException
+    {
+        Model model = null;
+        String parentRelativePath = parentModel.getRelativePath();
+
+        File parentDescriptor = new File(projectDir, parentRelativePath);
+        if ( useTarget )
+        {
+            File tempDescriptor;
+
+            if (parentDescriptor.isDirectory())
+            {
+                tempDescriptor = new File(parentDescriptor, "/target/pom.xml");
+            }
+            else
+            {
+                String fileName = parentDescriptor.getName();
+                tempDescriptor = new File(parentDescriptor.getParentFile(), "/target/" + fileName);
+            }
+            if (tempDescriptor.exists())
+            {
+                parentDescriptor = tempDescriptor;
+            }
+        }
+
+        if (getLogger().isDebugEnabled())
+        {
+            getLogger().debug("Searching for parent-POM: " + parentModel.getId() + " of project: " +
+                    project.getId() + " in relative path: " + parentRelativePath + " full path: " +
+                    parentDescriptor.getAbsolutePath());
+        }
+
+        if (parentDescriptor.isDirectory())
+        {
+            if (getLogger().isDebugEnabled())
+            {
+                getLogger().debug("Path specified in <relativePath/> (" + parentRelativePath +
+                        ") is a directory. Searching for 'pom.xml' within this directory.");
+            }
+
+            parentDescriptor = new File(parentDescriptor, "pom.xml");
+
+            if (!parentDescriptor.exists())
+            {
+                if (getLogger().isDebugEnabled())
+                {
+                    getLogger().debug("Parent-POM: " + parentModel.getId() + " for project: " +
+                            project.getId() + " cannot be loaded from relative path: " + parentDescriptor +
+                            "; path does not exist.");
+                }
+            }
+        }
+
+        if (parentDescriptor != null)
+        {
+            try
+            {
+                parentDescriptor = parentDescriptor.getCanonicalFile();
+            }
+            catch (IOException e)
+            {
+                getLogger().debug("Failed to canonicalize potential parent POM: \'" + parentDescriptor + "\'",
+                        e);
+
+                parentDescriptor = null;
+            }
+        }
+
+        if ((parentDescriptor != null) && parentDescriptor.exists())
+        {
+            Model candidateParent = readModel(projectId, parentDescriptor, strict);
+
+            String candidateParentGroupId = candidateParent.getGroupId();
+            if ((candidateParentGroupId == null) && (candidateParent.getParent() != null))
+            {
+                candidateParentGroupId = candidateParent.getParent().getGroupId();
+            }
+
+            String candidateParentVersion = candidateParent.getVersion();
+            if ((candidateParentVersion == null) && (candidateParent.getParent() != null))
+            {
+                candidateParentVersion = candidateParent.getParent().getVersion();
+            }
+
+            if (parentModel.getGroupId().equals(candidateParentGroupId) &&
+                    parentModel.getArtifactId().equals(candidateParent.getArtifactId()))
+            {
+                model = candidateParent;
+                getLogger().debug("Using parent-POM from the project hierarchy at: \'" +
+                        parentModel.getRelativePath() + "\' for project: " + project.getId());
+            }
+            else
+            {
+                getLogger().debug("Invalid parent-POM referenced by relative path '" +
+                        parentModel.getRelativePath() + "' in parent specification in " + project.getId() + ":" +
+                        "\n  Specified: " + parentModel.getId() + "\n  Found:     " + candidateParent.getId());
+            }
+        }
+        else if (getLogger().isDebugEnabled())
+        {
+            getLogger().debug(
+                    "Parent-POM: " + parentModel.getId() + " not found in relative path: " + parentRelativePath);
+        }
+        return new ModelWithFile(model, parentDescriptor);
+    }
+
     private void mergeManagedDependencies(Model model, ArtifactRepository localRepository, List parentSearchRepositories)
         throws ProjectBuildingException
     {

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/MavenProject.java?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/MavenProject.java (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/MavenProject.java Thu Aug 28 00:35:05 2008
@@ -94,6 +94,8 @@
 
     private File file;
 
+    private File originalFile;
+
     private Set artifacts;
 
     private Artifact parentArtifact;
@@ -146,6 +148,8 @@
     private Map projectReferences = new HashMap();
 
     private boolean executionRoot;
+
+    private boolean prepared = false;
     
     private Map moduleAdjustments;
 
@@ -448,6 +452,26 @@
         return basedir;
     }
 
+    public File getOriginalFile()
+    {
+        return originalFile;
+    }
+
+    public void setOriginalFile(File file)
+    {
+        this.originalFile = file;
+    }
+
+    public boolean isPrepared()
+    {
+        return this.prepared;
+    }
+
+    public void setPrepared(boolean prepared)
+    {
+        this.prepared = prepared;
+    }
+
     public void setDependencies( List dependencies )
     {
         getModel().setDependencies( dependencies );

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java Thu Aug 28 00:35:05 2008
@@ -48,6 +48,14 @@
         throws ProjectBuildingException;
 
     // ----------------------------------------------------------------------
+    // These methods are called by the EventMonitor
+    // ----------------------------------------------------------------------
+
+    void prepareProject(MavenProject project);
+
+    void cleanProject(MavenProject project);
+
+    // ----------------------------------------------------------------------
     // These methods are used by the MavenEmbedder
     // ----------------------------------------------------------------------
 

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java Thu Aug 28 00:35:05 2008
@@ -275,7 +275,7 @@
         for ( Iterator i = projectMap.values().iterator(); i.hasNext(); )
         {
             project = (MavenProject) i.next();
-            if ( projectDir.equals( project.getFile().getParentFile() ) ) return project;
+            if ( projectDir.equals( project.getBasedir() ) ) return project;
         }
         
         throw new MissingProjectException( "Couldn't find specified project in module list: " + projectDir.getAbsolutePath() );

Added: maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/DefaultModelTransformer.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/DefaultModelTransformer.java?rev=689746&view=auto
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/DefaultModelTransformer.java (added)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/DefaultModelTransformer.java Thu Aug 28 00:35:05 2008
@@ -0,0 +1,286 @@
+package org.apache.maven.project.transformation;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathConstants;
+
+import org.xml.sax.SAXException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.ProjectBuilderConfiguration;
+import org.apache.maven.model.Model;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.CollectionUtils;
+import org.codehaus.plexus.util.StringUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSSerializer;
+import org.w3c.dom.ls.LSOutput;
+
+/**
+ * This class itentifies the fields in the Model that must have their variables resolved before the pom can
+ * be stored into a repository. It provides the utility methods to replace the variables and create the new
+ * project file.
+ */
+public final class DefaultModelTransformer
+    extends AbstractLogEnabled
+    implements ModelTransformer
+{
+    /**
+     * The document builder
+     */
+    private final DocumentBuilder builder;
+
+    private final ModelItem[] items;
+
+
+    public DefaultModelTransformer() throws Exception
+    {
+        DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+        builderFactory.setValidating( false );
+        builderFactory.setExpandEntityReferences( false );
+        builderFactory.setNamespaceAware( false );
+        builderFactory.setAttribute( "http://apache.org/xml/features/nonvalidating/load-external-dtd",
+                                      Boolean.FALSE );
+        builder = builderFactory.newDocumentBuilder();
+
+        items = new ModelItem[] {
+            new ModelItem("/project/parent/version", "parent.version", "/project/parent/artifactId",
+                          ModelItem.Location.AFTER),
+            new ModelItem("/project/groupId", "groupId", "/project/artifactId", ModelItem.Location.BEFORE),
+            new ModelItem("/project/artifactId", "artifactId"),
+            new ModelItem("/project/version", "version", "project/artifactId", ModelItem.Location.AFTER)
+        };
+    }
+
+    /**
+     * Transform the model into a form acceptable to be stored into a repository.
+     * @param source The source pom file.
+     * @param target The target pom file.
+     * @param project The project created from the source pom file.
+     * @param projectId The current projectId for use in Exception messages.
+     * @param debug true if debug should be enabled.
+     * @return true if a new pom was written to the target directory.
+     * @throws ModelTransformationException If an error occurs processing the source file or creating the target.
+     */
+    public boolean transformModel( File source,
+                                   File target,
+                                   MavenProject project,
+                                   String projectId,
+                                   boolean debug )
+        throws ModelTransformationException
+    {
+        Logger logger = getLogger();
+        Document document;
+        Model model = project.getModel();
+        Model originalModel = project.getOriginalModel();
+        try
+        {
+            document = builder.parse(source);
+        }
+        catch ( IOException ioe )
+        {
+            throw new ModelTransformationException( "Parse failed in " + projectId + " for " +
+                                                     source.getAbsolutePath(), ioe );
+        }
+        catch ( SAXException ioe )
+        {
+            throw new ModelTransformationException( "Parse failed in " + projectId + " for " +
+                                                    source.getAbsolutePath(), ioe );
+        }
+
+        boolean replaced = false;
+
+        for ( ModelItem item : items )
+        {
+            // getValue returns null if the value in the original and current model are the same.
+            String value = getValue(item, model, originalModel);
+            if (value != null)
+            {
+                try
+                {
+                    Node node = (Node)item.expression.evaluate( document, XPathConstants.NODE );
+                    if (node != null)
+                    {
+                        node.setTextContent( value );
+                    }
+                    else if (item.location != null)
+                    {
+                        Node newNode = document.createElement( item.getTagName() );
+                        newNode.setTextContent( value );
+                        node = (Node)item.locationExpression.evaluate( document, XPathConstants.NODE );
+                        if (node != null)
+                        {
+                            Node previous = node.getPreviousSibling();
+                            Node parentNode = node.getParentNode();
+                            if (item.location == ModelItem.Location.AFTER)
+                            {
+                                Node sibling = node.getNextSibling();
+                                if (sibling == null)
+                                {
+                                    if ( previous != null && previous.getNodeType() == Node.TEXT_NODE )
+                                    {
+                                        Node text = previous.cloneNode( false );
+                                        parentNode.appendChild( text );
+                                    }
+                                    parentNode.appendChild( newNode );
+                                }
+                                else
+                                {
+                                    if ( previous != null && previous.getNodeType() == Node.TEXT_NODE )
+                                    {
+                                        Node text = previous.cloneNode( false );
+                                        parentNode.insertBefore( text, sibling );
+                                    }
+                                    parentNode.insertBefore( newNode, sibling );
+                                }
+                            }
+                            else
+                            {
+                                parentNode.insertBefore( newNode, node );
+                                Node sibling = node.getNextSibling();
+                                if ( sibling != null && sibling.getNodeType() == Node.TEXT_NODE )
+                                {
+                                    Node text = sibling.cloneNode( false );
+                                    parentNode.insertBefore( text, node );
+                                }
+                            }
+                        }
+                    }
+                    replaced = true;
+                }
+                catch (Error err)
+                {
+                    throw new ModelTransformationException ("Unable to insert" + item, err);
+                }
+                catch (XPathExpressionException xpee)
+                {
+                    throw new ModelTransformationException( "Failed to evaluate " + item, xpee);
+                }
+            }
+        }
+        if (!replaced)
+        {
+            return replaced;
+        }
+
+        try
+        {
+            logger.debug("Writing project to " + target.getAbsolutePath());
+            target.getParentFile().mkdirs();
+            DOMImplementation domImpl = document.getImplementation();
+
+            DOMImplementationLS domImplLS = (DOMImplementationLS) domImpl.getFeature("LS", "3.0");
+
+            LSSerializer serializer = domImplLS.createLSSerializer();
+
+            LSOutput serializerOut = domImplLS.createLSOutput();
+            serializerOut.setByteStream(new FileOutputStream(target));
+
+            serializer.write(document.getDocumentElement(), serializerOut);
+            return true;
+        }
+        catch ( FileNotFoundException e )
+        {
+            throw new ModelTransformationException("FileNotFoundException: " + e );
+        }
+    }
+
+    /**
+     * Replace the variables in the model items.
+     * @param model The target model.
+     * @param projectId The project Id for exception messages.
+     * @param config The current ProjectBuilderConfiguration.
+     * @throws ProjectBuildingException if an exception occurs interpolating the variables.
+     */
+    public void resolveModel(Model model, String projectId, ProjectBuilderConfiguration config )
+        throws ProjectBuildingException
+    {        
+        Map[] propMaps = new Map[] { config.getExecutionProperties(),
+                                     model.getProperties(),
+                                     config.getUserProperties() };
+
+        Map<String, String> props = CollectionUtils.mergeMaps( propMaps );
+
+        for (ModelItem item : items )
+        {
+            String value;
+            try
+            {
+                String src = item.getValue( model );
+                if (src != null)
+                {
+                    value = StringUtils.interpolate( src, props );
+                    if (value == null || src.equals(value))
+                    {
+                        continue;
+                    }
+                }
+                else
+                {
+                    continue;
+                }
+            }
+            catch ( Exception ex )
+            {
+                throw new ProjectBuildingException( projectId, "Unable to resolve " + item.modelPath, ex);
+            }
+            try
+            {
+                item.setValue( model, value );
+            }
+            catch ( Exception ex)
+            {
+                throw new ProjectBuildingException( projectId, "Unable to set value for " + item.modelPath, ex);
+            }
+        }
+    }
+
+    private String getValue(ModelItem item,
+                            Model model,
+                            Model originalModel)
+    {
+        try
+        {
+            String originalValue = item.getValue( originalModel );
+
+            String value = item.getValue( model );
+
+            if (value.equals(originalValue))
+            {
+                return null;
+            }
+            return value;
+        }
+        catch (Exception ex)
+        {
+            return null;
+        }
+    }
+}
\ No newline at end of file

Added: maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/ModelItem.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/ModelItem.java?rev=689746&view=auto
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/ModelItem.java (added)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/ModelItem.java Thu Aug 28 00:35:05 2008
@@ -0,0 +1,261 @@
+package org.apache.maven.project.transformation;
+
+import org.apache.maven.model.Model;
+import org.codehaus.plexus.interpolation.reflection.ClassMap;
+import org.codehaus.plexus.interpolation.util.StringUtils;
+
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathFactory;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This class is used to retrieve items from the Model object or its children and to access
+ * the corresponding item in the pom.xml.
+ *
+ * This class has package scope as it is only used by the DefaultModelTransformer.
+ */
+class ModelItem
+{
+    final XPathExpression expression;
+    final XPathExpression locationExpression;
+    final String modelPath;
+    final String insertPath;
+    private final String xpath;
+    enum Location { BEFORE, AFTER }
+    final Location location;
+
+    private final List<Method> getMethods;
+
+    private final List<Method> setMethods;   
+
+    private static final Class[] GET_ARG_TYPES = new Class[0];
+
+    private static final Object[] GET_ARGS = new Object[0];
+
+    private static final Map<Class, ClassMap> classMaps = new WeakHashMap<Class, ClassMap>();
+
+    private static XPathFactory factory = XPathFactory.newInstance();
+
+    /**
+     * Create a ModelItem.
+     * @param xpath The xpath expression to allow traversal from the beginning of the pom to the desired element.
+     * @param modelPath dottend notation to allow access to members, relative to the model object.
+     * @throws Exception if an error occurs while compiling the xpath or traversing the model path.
+     */
+    ModelItem( String xpath, String modelPath)
+        throws Exception
+    {
+        this( xpath, modelPath, null, null);
+    }
+
+    ModelItem ( String xpath, String modelPath, String insertPath, Location location)
+        throws Exception
+    {
+        this.expression = factory.newXPath().compile( xpath );
+        this.xpath = xpath;
+        this.modelPath = modelPath;
+        this.getMethods = setupGetters( modelPath );
+        this.setMethods = setupSetters( modelPath );
+        this.insertPath = insertPath;
+        this.location = ( insertPath != null && location == null ) ? Location.AFTER : location;
+        this.locationExpression = ( insertPath != null ) ? factory.newXPath().compile( insertPath ) : null;
+    }
+
+    /**
+     * Retrieve the value associated with this item from the model.
+     * @param model The model to retrieve the value from.
+     * @return The value or null if the value or one of its parents is not present.
+     * @throws Exception if an error occurs traversing the model.
+     */
+    String getValue( Model model )
+        throws Exception
+    {
+        Object value = model;
+        for ( Method method : getMethods )
+        {
+            value = method.invoke( value, GET_ARGS );
+            if ( value == null )
+            {
+                return null;
+            }
+        }
+        return (String) value;
+    }
+
+    /**
+     * Set the value associated with this item in the model.
+     * @param model The model to retrieve the value from.
+     * @param value The value to set the element to.
+     * @throws Exception if an error occurs traversing the model.
+     */
+    void setValue( Model model, Object value )
+        throws Exception
+    {
+        Object obj = model;
+        int count = setMethods.size();
+        for ( Method method : setMethods )
+        {
+            if (--count > 0)
+            {
+                obj = method.invoke( obj, GET_ARGS );
+            }
+            else
+            {
+                Object[] args = new Object[] { value };
+                method.invoke(obj, args);
+                return;
+            }
+
+            if ( obj == null )
+            {
+                return;
+            }
+        }
+    }
+
+    public String toString()
+    {
+        return xpath;
+    }
+
+    /**
+     * Returns the name of the element that will contain the text.
+     * @return The element name associated with the ModelItem's xpath expression.
+     */
+    public String getTagName()
+    {
+        return xpath.substring(xpath.lastIndexOf( "/" ) + 1);
+    }
+
+    private List<Method> setupGetters( String modelPath )
+        throws Exception
+    {
+        List<Method> list = new ArrayList<Method>();
+        Class clazz = Model.class;
+
+        StringTokenizer parser = new StringTokenizer( modelPath, "." );
+
+        while ( parser.hasMoreTokens() )
+        {
+            String token = parser.nextToken();
+
+            ClassMap classMap = getClassMap( clazz );
+
+            if ( clazz == null )
+            {
+                return null;
+            }
+
+            String methodBase = StringUtils.capitalizeFirstLetter( token );
+
+            String methodName = "get" + methodBase;
+
+            Method method = classMap.findMethod( methodName, GET_ARG_TYPES );
+
+            if ( method == null )
+            {
+                // perhaps this is a boolean property??
+                methodName = "is" + methodBase;
+
+                method = classMap.findMethod( methodName, GET_ARG_TYPES );
+            }
+
+            if ( method == null )
+            {
+                return null;
+            }
+            list.add( method );
+            clazz = method.getReturnType();
+        }
+        return list;
+    }
+
+    private List<Method> setupSetters( String modelPath )
+        throws Exception
+    {
+        List<Method> list = new ArrayList<Method>();
+        Class clazz = Model.class;
+
+        StringTokenizer parser = new StringTokenizer( modelPath, "." );
+        int count = parser.countTokens();
+
+        while ( parser.hasMoreTokens() )
+        {
+            String token = parser.nextToken();
+
+            if ( clazz == null )
+            {
+                throw new IllegalArgumentException("Could not locate class for " + token + " in " + modelPath );
+            }
+
+            ClassMap classMap = getClassMap( clazz );
+
+            String methodBase = StringUtils.capitalizeFirstLetter( token );
+
+            String methodName = "get" + methodBase;
+
+            Method method = classMap.findMethod( methodName, GET_ARG_TYPES );
+
+            if ( method == null )
+            {
+                throw new IllegalArgumentException( "Could not locate method " + methodName +
+                    "() in class " + clazz.getName());
+            }
+
+            Class argClass = method.getReturnType();
+
+            if (--count == 0)
+            {
+                methodName = "set" + methodBase;
+
+                Object[] args = new Object[1];
+                args[0] = argClass.newInstance();
+                method = classMap.findMethod( methodName, args);
+
+                if (method == null)
+                {
+                    throw new IllegalArgumentException( "Could not locate method " + methodName +
+                        "(" + argClass.getName() + ") in class " + clazz.getName() );
+                }
+            }
+            list.add(method);
+        }
+        return list;
+    }
+
+    private static ClassMap getClassMap( Class clazz )
+    {
+        ClassMap classMap = classMaps.get( clazz );
+
+        if ( classMap == null )
+        {
+            classMap = new ClassMap( clazz );
+
+            classMaps.put( clazz, classMap );
+        }
+
+        return classMap;
+    }
+}
\ No newline at end of file

Added: maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/ModelTransformationException.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/ModelTransformationException.java?rev=689746&view=auto
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/ModelTransformationException.java (added)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/ModelTransformationException.java Thu Aug 28 00:35:05 2008
@@ -0,0 +1,34 @@
+package org.apache.maven.project.transformation;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class ModelTransformationException
+    extends RuntimeException
+{
+    public ModelTransformationException( String message )
+    {
+        super( message );
+    }
+
+    public ModelTransformationException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}
\ No newline at end of file

Added: maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/ModelTransformer.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/ModelTransformer.java?rev=689746&view=auto
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/ModelTransformer.java (added)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/java/org/apache/maven/project/transformation/ModelTransformer.java Thu Aug 28 00:35:05 2008
@@ -0,0 +1,56 @@
+package org.apache.maven.project.transformation;
+
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.ProjectBuilderConfiguration;
+import org.apache.maven.model.Model;
+
+import java.io.File;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public interface ModelTransformer
+{
+    /**
+     * Transform the model into a form acceptable to be stored into a repository.
+     * @param source The source pom file.
+     * @param target The target pom file.
+     * @param project The project created from the source pom file.
+     * @param projectId The current projectId for use in Exception messages.
+     * @param debug true if debug should be enabled.
+     * @return true if a new pom was written to the target directory.
+     * @throws ModelTransformationException If an error occurs processing the source file or creating the target.
+     */
+    boolean transformModel( File source,
+                            File target,
+                            MavenProject project,
+                            String projectId,
+                            boolean debug )
+        throws ModelTransformationException;
+
+    /**
+     * Replace the variables in the model items.
+     * @param model The target model.
+     * @param projectId The project Id for exception messages.
+     * @param config The current ProjectBuilderConfiguration.
+     * @throws ProjectBuildingException if an exception occurs interpolating the variables.
+     */
+    void resolveModel( Model model,
+                       String projectId,
+                       ProjectBuilderConfiguration config )
+        throws ProjectBuildingException;
+}
\ No newline at end of file

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/resources/META-INF/plexus/components.xml?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/main/resources/META-INF/plexus/components.xml Thu Aug 28 00:35:05 2008
@@ -53,6 +53,15 @@
      |
      -->
     <component>
+      <role>org.apache.maven.project.transformation.ModelTransformer</role>
+      <implementation>org.apache.maven.project.transformation.DefaultModelTransformer</implementation>
+    </component>
+<!--
+     |
+     |
+     |
+     -->
+    <component>
       <role>org.apache.maven.project.injection.ModelDefaultsInjector</role>
       <implementation>org.apache.maven.project.injection.DefaultModelDefaultsInjector</implementation>
     </component>
@@ -90,6 +99,9 @@
           <role>org.apache.maven.project.inheritance.ModelInheritanceAssembler</role>
         </requirement>
         <requirement>
+          <role>org.apache.maven.project.transformation.ModelTransformer</role>
+        </requirement>
+        <requirement>
           <role>org.apache.maven.project.validation.ModelValidator</role>
         </requirement>
         <requirement>

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/test/resources/org/apache/maven/project/ProjectClasspathTest.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/test/resources/org/apache/maven/project/ProjectClasspathTest.xml?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/test/resources/org/apache/maven/project/ProjectClasspathTest.xml (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/test/resources/org/apache/maven/project/ProjectClasspathTest.xml Thu Aug 28 00:35:05 2008
@@ -78,6 +78,9 @@
           <role>org.apache.maven.project.inheritance.ModelInheritanceAssembler</role>
         </requirement>
         <requirement>
+          <role>org.apache.maven.project.transformation.ModelTransformer</role>
+        </requirement>
+        <requirement>
           <role>org.apache.maven.project.validation.ModelValidator</role>
         </requirement>
         <requirement>

Modified: maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/test/resources/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/test/resources/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.xml?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/test/resources/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.xml (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/maven-project/src/test/resources/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.xml Thu Aug 28 00:35:05 2008
@@ -78,6 +78,9 @@
           <role>org.apache.maven.project.inheritance.ModelInheritanceAssembler</role>
         </requirement>
         <requirement>
+          <role>org.apache.maven.project.transformation.ModelTransformer</role>
+        </requirement>        
+        <requirement>
           <role>org.apache.maven.project.validation.ModelValidator</role>
         </requirement>
         <requirement>

Modified: maven/components/branches/maven-2.1.x-MNG-624/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x-MNG-624/pom.xml?rev=689746&r1=689745&r2=689746&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x-MNG-624/pom.xml (original)
+++ maven/components/branches/maven-2.1.x-MNG-624/pom.xml Thu Aug 28 00:35:05 2008
@@ -147,6 +147,11 @@
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>2.0.2</version>
+          <configuration>
+            <source>1.5</source>
+            <target>1.5</target>
+            <encoding>${project.build.sourceEncoding}</encoding>
+          </configuration>
         </plugin>
         <plugin>
           <artifactId>maven-assembly-plugin</artifactId>
@@ -235,6 +240,8 @@
               <exclude>org/apache/maven/project/inheritance/ModelInheritanceAssembler*</exclude>
               <exclude>org/apache/maven/execution/MavenExecutionRequest*</exclude>
               <exclude>org/apache/maven/plugin/DefaultPluginManager*</exclude>
+              <!-- All event monitor classes were changed to take a MavenEvent instead of a String -->
+              <exclude>org/apache/maven/monitor/event/*</exclude>
             </excludes>
           </configuration>
         </plugin>



Mime
View raw message