Custom build of Apache Maven trunk as of Jun/22/2008
1. the binary needs to be shaded (most references to org.codehaus.util.* need to be changed to
   hidden.org.codehaus.util.*
2. the apache maven wagon dependencies need to be 1.0-beta-4 (#143319)
3. patch a PropertyEditors.java class in apache's xbean-reflect jar (#135868)
4. #153108 correct ampersand in property values for interpolation.
5. #157071 changed version property value in META-INF/maven/org.apache.maven/maven-core/pom.properties to get past prerequisite checks. Use 2.9-SNAPSHOT version to avoid claiming to be able to handle 3.0 dependent builds.
6. #162887 avoid a NPE when downloading dependencies if settings.xml file's mirror setting is missing the mirrorOf element.
7. #144007 avoid NPE when distribution repository has null id.
8. #157691, #135043 correct populating of remote repository lists during model lineage assembly.
9. #163268 plugin extensions need to have the version assigned from managed plugin configuration
10. if extension defines version as ${project.version} and the current pom.xml file only inherits version from parent, the expression is not evaluated.
11. when pluginManagement defined the version and project/plugins defined <extensions>, the version was not picked up correctly.

# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /home/mkleint/src/xbean/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: PropertyEditors.java
--- PropertyEditors.java Base (BASE)
+++ PropertyEditors.java Locally Modified (Based On LOCAL)
@@ -134,16 +134,13 @@
         if (converter == null) throw new NullPointerException("editor is null");
         Class type = converter.getType();
         registry.put(type, converter);
-        PropertyEditorManager.registerEditor(type, converter.getClass());

         if (PRIMITIVE_TO_WRAPPER.containsKey(type)) {
             Class wrapperType = (Class) PRIMITIVE_TO_WRAPPER.get(type);
             registry.put(wrapperType, converter);
-            PropertyEditorManager.registerEditor(wrapperType, converter.getClass());
         } else if (WRAPPER_TO_PRIMITIVE.containsKey(type)) {
             Class primitiveType = (Class) WRAPPER_TO_PRIMITIVE.get(type);
             registry.put(primitiveType, converter);
-            PropertyEditorManager.registerEditor(primitiveType, converter.getClass());
         }
     }

@@ -175,11 +172,6 @@
             return converter;
         }

-        // fall back to a property editor
-        PropertyEditor editor = findEditor(type);
-        if (editor != null) {
-            return editor;
-        }

         converter = findBuiltinConverter(type);
         if (converter != null) {

# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /home/mkleint/src/maven-for-netbeans/components/maven-project/src/main/java/org/apache/maven/project/interpolation
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: RegexBasedModelInterpolator.java
--- RegexBasedModelInterpolator.java Base (BASE)
+++ RegexBasedModelInterpolator.java Locally Modified (Based On LOCAL)
@@ -47,6 +47,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;

@@ -220,7 +221,20 @@
         interpolator.addValueSource( basedirValueSource );
         interpolator.addValueSource( new MapBasedValueSource( overrideContext ) );
         interpolator.addValueSource( modelValueSource1 );
-        interpolator.addValueSource( new PrefixedValueSourceWrapper( new MapBasedValueSource( model.getProperties() ), PROJECT_PREFIXES, true ) );
+        Properties props = new Properties();
+        props.putAll(model.getProperties());
+        Iterator iter = props.entrySet().iterator();
+        while (iter.hasNext()) {
+            Map.Entry en = (Map.Entry) iter.next();
+            String val = en.getValue() != null ? en.getValue().toString() : null;
+            if (val != null) {
+                val = val.replace("&", "&amp;");
+                en.setValue(val);
+            }
+        }
+
+
+        interpolator.addValueSource( new PrefixedValueSourceWrapper( new MapBasedValueSource( props ), PROJECT_PREFIXES, true ) );
         interpolator.addValueSource( modelValueSource2 );
         interpolator.addValueSource( new MapBasedValueSource( context ) );


# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /home/mkleint/src/maven-for-netbeans/artifact/src/main/java/org/apache/maven/artifact/manager
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: DefaultWagonManager.java
--- DefaultWagonManager.java Base (BASE)
+++ DefaultWagonManager.java Locally Modified (Based On LOCAL)
@@ -859,6 +859,9 @@
         boolean result = false;
         String originalId = originalRepository.getId();

+        if (pattern == null) {
+            return false;
+        }
         // simple checks first to short circuit processing below.
         if ( WILDCARD.equals( pattern ) || pattern.equals( originalId ) )
         {


# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /home/mkleint/src/maven-for-netbeans/components/maven-project/src/main/java/org/apache/maven
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: DefaultMavenTools.java
--- DefaultMavenTools.java Base (BASE)
+++ DefaultMavenTools.java Locally Modified (Based On LOCAL)
@@ -69,7 +69,9 @@
         {
             String id = repo.getId();
             String url = repo.getUrl();
-
+            if ( id == null || url == null) {
+                return null;
+            }
             return artifactRepositoryFactory.createDeploymentArtifactRepository( id, url, repo.getLayout(),
                                                                                  repo.isUniqueVersion() );
         }


# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /home/mkleint/src/maven-for-netbeans/components/maven-project/src/main/java/org/apache/maven/project/build/model
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: DefaultModelLineageBuilder.java
--- DefaultModelLineageBuilder.java Base (BASE)
+++ DefaultModelLineageBuilder.java Locally Modified (Based On LOCAL)
@@ -107,6 +107,12 @@

         do
         {
+            currentRemoteRepositories = updateRepositorySet( current.getModel(),
+                                                             currentRemoteRepositories,
+                                                             current.getFile(),
+                                                             config,
+                                                             current.isValidProfilesXmlLocation() );
+
             if ( lineage.size() == 0 )
             {
                 lineage.setOrigin( current.getModel(),
@@ -122,11 +128,6 @@
                                    current.isValidProfilesXmlLocation() );
             }

-            currentRemoteRepositories = updateRepositorySet( current.getModel(),
-                                                             currentRemoteRepositories,
-                                                             current.getFile(),
-                                                             config,
-                                                             current.isValidProfilesXmlLocation() );

             current = resolveParentPom( current,
                                         currentRemoteRepositories,
@@ -158,6 +159,8 @@
             currentRemoteRepositories = new ArrayList();
         }

+        currentRemoteRepositories.addAll( lineage.getOriginatingArtifactRepositoryList() );
+
         ModelAndFile current = new ModelAndFile( lineage.getDeepestAncestorModel(),
                                                  lineage.getDeepestAncestorFile(),
                                                  lineage.isDeepestAncestorUsingProfilesXml() );



# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /home/mkleint/src/maven-for-netbeans/components/maven-core/src/main/java/org/apache/maven/extension
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: DefaultBuildExtensionScanner.java
--- DefaultBuildExtensionScanner.java Base (BASE)
+++ DefaultBuildExtensionScanner.java Locally Modified (Based On LOCAL)
@@ -142,8 +142,10 @@

             inheritedRemoteRepositories.addAll( originalRemoteRepositories );

-            Set managedPluginsWithExtensionsFlag = new HashSet();
+            Map managedPluginsWithExtensionsFlag = new HashMap();

+            Map managedPlugins = new HashMap();
+
             for ( ModelLineageIterator lineageIterator = lineage.reversedLineageIterator(); lineageIterator.hasNext(); )
             {
                 Model model = (Model) lineageIterator.next();
@@ -164,13 +166,22 @@

                 model = modelInterpolator.interpolate( model, inheritedInterpolationValues, request.getUserProperties(), false );

-                grabManagedPluginsWithExtensionsFlagTurnedOn( model, managedPluginsWithExtensionsFlag );
+                grabManagedPluginsWithExtensionsFlagTurnedOn( model, managedPluginsWithExtensionsFlag, managedPlugins );

                 Properties modelProps = model.getProperties();
                 if ( modelProps != null )
                 {
                     inheritedInterpolationValues.putAll( modelProps );
                 }
+                if (model.getVersion() != null) {
+                    inheritedInterpolationValues.put("project.version", model.getVersion());
+                }
+                if (model.getArtifactId() != null) {
+                    inheritedInterpolationValues.put("project.artifactId", model.getArtifactId());
+                }
+                if (model.getGroupId() != null) {
+                    inheritedInterpolationValues.put("project.groupId", model.getGroupId());
+                }

                 if ( visitedModelIds.contains( key ) )
                 {
@@ -184,7 +195,7 @@
                                    "Checking: " + model.getId() + " for extensions. (It has "
                                        + model.getModules().size() + " modules.)" );

-                checkModelBuildForExtensions( model, request, inheritedRemoteRepositories, managedPluginsWithExtensionsFlag );
+                checkModelBuildForExtensions( model, request, inheritedRemoteRepositories, managedPluginsWithExtensionsFlag, managedPlugins );

                 if ( !reactorFiles.contains( modelPom ) )
                 {
@@ -212,7 +223,8 @@
     }

     private void grabManagedPluginsWithExtensionsFlagTurnedOn( Model model,
-                                                               Set managedPluginsWithExtensionsFlag )
+                                                               Map managedPluginsWithExtensionsFlag,
+                                                               Map managedPlugins )
     {
         Build build = model.getBuild();
         if ( build != null )
@@ -228,8 +240,9 @@
                         Plugin plugin = (Plugin) it.next();
                         if ( plugin.isExtensions() )
                         {
-                            managedPluginsWithExtensionsFlag.add( plugin.getKey() );
+                            managedPluginsWithExtensionsFlag.put( plugin.getKey(), plugin );
                         }
+                        managedPlugins.put( plugin.getKey(), plugin );
                     }
                 }
             }
@@ -336,7 +349,8 @@
     private void checkModelBuildForExtensions( Model model,
                                                MavenExecutionRequest request,
                                                List remoteRepositories,
-                                               Set managedPluginsWithExtensionsFlag )
+                                               Map managedPluginsWithExtensionsFlag,
+                                               Map managedPlugins)
         throws ExtensionScanningException
     {
         getLogger().debug( "Checking " + model.getId() + " for extensions." );
@@ -380,10 +394,13 @@
                 {
                     Plugin plugin = (Plugin) extensionIterator.next();

-                    if ( plugin.isExtensions() || managedPluginsWithExtensionsFlag.contains( plugin.getKey() ) )
+                    if ( plugin.isExtensions() || managedPluginsWithExtensionsFlag.containsKey( plugin.getKey() ) )
                     {
                         getLogger().debug( "Adding plugin: " + plugin.getKey() + " as an extension(from model: " + model.getId() + ")" );
-
+                        Plugin manPlugin = (Plugin) managedPlugins.get( plugin.getKey() );
+                        if (plugin.getVersion() == null && manPlugin != null) {
+                            plugin.setVersion( manPlugin.getVersion() );
+                        }
                         try
                         {
                             extensionManager.addPluginAsExtension( plugin, model, remoteRepositories, request );
