package org.apache.maven.plugin.resources.remote;

/*
 * 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.IOException;
import java.net.URLClassLoader;
import java.net.URL;
import java.util.Enumeration;

/**
 * @author Jason van Zyl
 */
public class RemoteResourcesClassLoader
    extends URLClassLoader
{
    public RemoteResourcesClassLoader( ClassLoader parent )
    {
        super( new URL[]{} , parent );
    }

    public void addURL( URL url )
    {
        super.addURL( url );
    }
    
    // don't check the parents for the resources.   Just check the jars
    // that we have provided.   Thus, we don't pull junk from the
    // system classpath jars and stuff instead of the jars
    // we specifically provided
    public URL getResource(String name) 
    {
        return findResource(name);
    }
    public Enumeration getResources(String name) throws IOException 
    {
        return findResources(name);
    }

}

@@ -1515,16 +1515,17 @@
 esource(
+ 
 String n
@@ -1527,16 +1527,17 @@
 ing name
+ 
 ) %0A    %7B
@@ -1541,35 +1541,120 @@
   %7B%0A        
-return find
+URL url = findResource( name );%0A        if ( url == null )%0A        %7B%0A            url = super.get
 Resource(nam
@@ -1650,23 +1650,55 @@
 esource(
+ 
 name
+ 
 );%0A
+        %7D%0A        return url;%0A
     %7D%0A  
@@ -1731,16 +1731,17 @@
 sources(
+ 
 String n
@@ -1743,16 +1743,17 @@
 ing name
+ 
 ) throws
@@ -1780,22 +1780,32 @@
         
-return
+Enumeration en =
  findRes
@@ -1815,13 +1815,150 @@
 ces(
+ 
 name
-)
+ );%0A        if ( en == null %7C%7C !en.hasMoreElements() )%0A        %7B%0A            en = super.getResources( name );%0A        %7D%0A        return en
 ;%0A  

Update classloader to go back to the parent if the resource doesn't exist. Thus, velocity can find it's own stuff.