You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by dk...@apache.org on 2009/09/01 18:55:14 UTC

svn commit: r810121 - in /maven/plugins/trunk/maven-remote-resources-plugin/src: main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java

Author: dkulp
Date: Tue Sep  1 16:55:14 2009
New Revision: 810121

URL: http://svn.apache.org/viewvc?rev=810121&view=rev
Log:
[MRRESOURCES-43] Add ability to load supplimental models from remote
artifacts and not direct dependencies of the plugin

Modified:
    maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java
    maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java

Modified: maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java?rev=810121&r1=810120&r2=810121&view=diff
==============================================================================
--- maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java (original)
+++ maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java Tue Sep  1 16:55:14 2009
@@ -237,9 +237,19 @@
     private String[] supplementalModels;
 
     /**
+     * List of artifacts that are added to the search path when looking 
+     * for supplementalModels
+     * @parameter
+     * @since 1.1 
+     */
+    private List supplementalModelArtifacts;
+
+    /**
      * Map of artifacts to supplemental project object models.
      */
     private Map supplementModels;
+    
+    
 
     /**
      * Merges supplemental data model with artifact
@@ -269,7 +279,7 @@
     private boolean skip;
 
     /**
-     * Skip remote-resource processing
+     * Attaches the resource to the project as a resource directory
      *
      * @parameter default-value="true"
      * @since 1.0-beta-1
@@ -466,6 +476,7 @@
             }
         }
 
+        addSupplementalModelArtifacts();
         locator.addSearchPath( FileResourceLoader.ID, project.getFile().getParentFile().getAbsolutePath() );
         if ( appendedResourcesDirectory != null )
         {
@@ -481,7 +492,7 @@
 
             validate();
 
-            List resourceBundleArtifacts = downloadResourceBundles( resourceBundles );
+            List resourceBundleArtifacts = downloadBundles( resourceBundles );
             supplementModels = loadSupplements( supplementalModels );
 
             VelocityContext context = new VelocityContext( properties );
@@ -531,6 +542,38 @@
         }
     }
 
+    private void addSupplementalModelArtifacts() throws MojoExecutionException
+    {
+        if ( supplementalModelArtifacts != null && !supplementalModelArtifacts.isEmpty() )
+        {
+            List artifacts = downloadBundles( supplementalModelArtifacts );
+            
+            for ( Iterator i = artifacts.iterator(); i.hasNext(); )
+            {
+                File artifact = (File) i.next();
+                
+                if ( artifact.isDirectory() ) 
+                {
+                    locator.addSearchPath( FileResourceLoader.ID, artifact.getAbsolutePath() );
+                }
+                else
+                {
+                    try 
+                    {
+                        locator.addSearchPath( "jar", "jar:" + artifact.toURL().toExternalForm() );
+                    } 
+                    catch (MalformedURLException e) 
+                    {
+                        throw new MojoExecutionException( "Could not use jar " 
+                                                          + artifact.getAbsolutePath(), e );
+                    }
+                }
+            }
+
+            
+        }
+    }
+
     protected List getProjects()
         throws MojoExecutionException
     {
@@ -925,24 +968,44 @@
         }
     }
 
-    private List downloadResourceBundles( List resourceBundles )
+    private List downloadBundles( List bundles )
         throws MojoExecutionException
     {
-        List resourceBundleArtifacts = new ArrayList();
+        List bundleArtifacts = new ArrayList();
 
         try
         {
-            for ( Iterator i = resourceBundles.iterator(); i.hasNext(); )
+            for ( Iterator i = bundles.iterator(); i.hasNext(); )
             {
                 String artifactDescriptor = (String) i.next();
                 // groupId:artifactId:version
                 String[] s = artifactDescriptor.split( ":" );
-                File artifact = downloader.download( s[0], s[1], s[2], localRepository,
+                File artifact = null;
+                //check if the artifact is part of the reactor
+                if ( mavenSession != null ) 
+                {
+                    List list = mavenSession.getSortedProjects();
+                    Iterator it = list.iterator();
+                    while ( it.hasNext() )
+                    {
+                        MavenProject p = (MavenProject) it.next();
+                        if ( s[0].equals( p.getGroupId() )
+                            && s[1].equals( p.getArtifactId() ) 
+                            && s[2].equals( p.getVersion() ) ) 
+                        {
+                            artifact = new File( p.getBuild().getOutputDirectory() );
+                        }
+                    }
+                }
+                if ( artifact == null || !artifact.exists() )
+                {
+                    artifact = downloader.download( s[0], s[1], s[2], localRepository,
                                                      ProjectUtils.buildArtifactRepositories( repositories,
                                                                                              artifactRepositoryFactory,
                                                                                              mavenSession.getContainer() ) );
+                }
 
-                resourceBundleArtifacts.add( artifact );
+                bundleArtifacts.add( artifact );
             }
         }
         catch ( DownloadException e )
@@ -958,7 +1021,7 @@
             throw new MojoExecutionException( "Resources JAR cannot be found.", e );
         }
 
-        return resourceBundleArtifacts;
+        return bundleArtifacts;
     }
 
     private void initalizeClassloader( RemoteResourcesClassLoader cl, List artifacts )

Modified: maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java?rev=810121&r1=810120&r2=810121&view=diff
==============================================================================
--- maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java (original)
+++ maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java Tue Sep  1 16:55:14 2009
@@ -24,6 +24,7 @@
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.ReactorManager;
 import org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.project.MavenProject;
@@ -385,7 +386,7 @@
                                     null, //Settings settings,
                                     null, //ArtifactRepository localRepository,
                                     null, //EventDispatcher eventDispatcher,
-                                    null, //ReactorManager reactorManager,
+                                    new ReactorManager(new ArrayList()),
                                     Arrays.asList( new String[] {"install"} ),
                                     project.getBasedir().toString(),
                                     new Properties(),



Re: svn commit: r810121 - in /maven/plugins/trunk/maven-remote-resources-plugin/src: main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java

Posted by Daniel Kulp <dk...@apache.org>.
Yep.   That's the issue.  (I was searching for it, just didn't check the 
closed issues.  Cool.)

Dan


On Tue September 8 2009 10:33:35 am Benjamin Bentmann wrote:
> Jason van Zyl wrote:
> >> And b configures a plugin with dependency foo, and c configures the same
> >> plugin, but with dependency bar, if I run mvn in "c", it works fine
> >> (gets bar), but if I run from a, it doesn't work right in c.   It just
> >> gets foo.
> >> Thus, it works differently depending on where I type "mvn".   To me,
> >> that is bad.
> >
> > Yes, it's bad. You just want the classloader scoped for the specified
> > dependencies. Should be easy enough to make an IT for that and fix it in
> > 3.x.
> 
> As far as I understand Daniel's issue, he talks about MNG-1323 which is
> already fixed on trunk.
> 
> 
> Benjamin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r810121 - in /maven/plugins/trunk/maven-remote-resources-plugin/src: main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java

Posted by Jason van Zyl <jv...@sonatype.com>.
There you go another reason to use 3.x now.

On 2009-09-08, at 4:33 PM, Benjamin Bentmann wrote:

> Jason van Zyl wrote:
>
>>> And b configures a plugin with dependency foo, and c configures  
>>> the same
>>> plugin, but with dependency bar, if I run mvn in "c", it works  
>>> fine (gets
>>> bar), but if I run from a, it doesn't work right in c.   It just  
>>> gets foo.
>>> Thus, it works differently depending on where I type "mvn".   To  
>>> me, that is bad.
>>>
>> Yes, it's bad. You just want the classloader scoped for the  
>> specified dependencies. Should be easy enough to make an IT for  
>> that and fix it in 3.x.
>
> As far as I understand Daniel's issue, he talks about MNG-1323 which  
> is already fixed on trunk.
>
>
> Benjamin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
http://twitter.com/SonatypeNexus
http://twitter.com/SonatypeM2E
----------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r810121 - in /maven/plugins/trunk/maven-remote-resources-plugin/src: main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java

Posted by Benjamin Bentmann <be...@udo.edu>.
Jason van Zyl wrote:

>> And b configures a plugin with dependency foo, and c configures the same
>> plugin, but with dependency bar, if I run mvn in "c", it works fine (gets
>> bar), but if I run from a, it doesn't work right in c.   It just gets 
>> foo.
>> Thus, it works differently depending on where I type "mvn".   To me, 
>> that is bad.
>>
> 
> Yes, it's bad. You just want the classloader scoped for the specified 
> dependencies. Should be easy enough to make an IT for that and fix it in 
> 3.x.

As far as I understand Daniel's issue, he talks about MNG-1323 which is 
already fixed on trunk.


Benjamin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r810121 - in /maven/plugins/trunk/maven-remote-resources-plugin/src: main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java

Posted by Jason van Zyl <jv...@sonatype.com>.
On 2009-09-08, at 3:51 PM, Daniel Kulp wrote:

> On Tue September 8 2009 4:15:05 am Jason van Zyl wrote:
>> On 2009-09-01, at 7:22 PM, Daniel Kulp wrote:
>>> However, to accomplish that, we HAVE to make sure the remote-
>>> resources is NOT
>>> loaded in buildtools.   Otherwise, due to the bug in maven that
>>> doesn't re-
>>> evaluate plugin dependencies after the first load, the subsequent
>>> modules
>>> would not be able to get the supplements.
>>
>> Why would we want to revaluate the dependencies after the first load?
>
> It's not a "first load" thing, it's a "per module" thing.
>
> If I have a reactor:
>
> a
> -> b
> -> c
>
> And b configures a plugin with dependency foo, and c configures the  
> same
> plugin, but with dependency bar, if I run mvn in "c", it works fine  
> (gets
> bar), but if I run from a, it doesn't work right in c.   It just  
> gets foo.
> Thus, it works differently depending on where I type "mvn".   To me,  
> that is
> bad.
>

Yes, it's bad. You just want the classloader scoped for the specified  
dependencies. Should be easy enough to make an IT for that and fix it  
in 3.x.

> Other than remote resources, the other plugin I've hit this time and  
> time
> again is antrun.     In the above, if (b) just uses antrun without any
> dependencies to do basic things, but (c) requires the trax  
> dependencies for
> xslt processing, you have to configure the trax in (b) as well,  
> which is
> stupid.  (yes, the proper thing is to configure in pluginManagement  
> in a, but
> my point is the same, the current behavior yields different results  
> depending
> on where it's run)

That is bad too. Again, probably not hard to model with and test.

>
>
> ........
>>> We either need the bug in maven fixed (and on 2.0.x) or we need this
>>> fixed or
>>> we just say Apache parent is useless for us.   We've BEEN saying
>>> Apache parent
>>> is useless, but I want to change that.
>>
>> Or how about changing the facility in the RR plugin? You need to
>> specify resources bundles and supplemental models. So if the plugin
>> took care of the loading of these elements that would be more self-
>> contained.
>
>
> Umm..  that's exactly what the commit does.   It adds configuration  
> for
> artifacts to look in for the supplemental models.  That way, it's  
> not a
> "dependency" thing, it's a configuration thing..    It works exactly  
> (shares
> the same code) as the configuration for the resource-bundles itself.
>

Ok, well I'll use your use case for the first in a series of helper  
components so this is not duplicated all over the place in 3.x.

>> I partially understand. Just not too comfortable with changes made  
>> for
>> specific projects like CXF when I haven't seen the use case crop up
>> anywhere else.
>
> Quite possibly because few projects use the supplemental models.    
> CXF has a
> very broad set of dependencies and a lot of them have crappy poms  
> that need
> the supplements.   Personally, I'd love to have the deploy plugin  
> updated to
> refuse to deploy poms that don't have the basic bits of information  
> (name,
> url, licenses, organization, etc...), but users probably wouldn't  
> like that
> and it doesn't solve the problem of artifacts not built with maven.
>

Unfortunately this will not work. We tried to be more strict with  
things in the POM and we just had too many complaints. In 3.x we got  
strict about versions and particular elements and our clients and  
people we were testing with just complained.

> -- 
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
http://twitter.com/SonatypeNexus
http://twitter.com/SonatypeM2E
----------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r810121 - in /maven/plugins/trunk/maven-remote-resources-plugin/src: main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java

Posted by Daniel Kulp <dk...@apache.org>.
On Tue September 8 2009 4:15:05 am Jason van Zyl wrote:
> On 2009-09-01, at 7:22 PM, Daniel Kulp wrote:
> > However, to accomplish that, we HAVE to make sure the remote-
> > resources is NOT
> > loaded in buildtools.   Otherwise, due to the bug in maven that
> > doesn't re-
> > evaluate plugin dependencies after the first load, the subsequent
> > modules
> > would not be able to get the supplements.
> 
> Why would we want to revaluate the dependencies after the first load?

It's not a "first load" thing, it's a "per module" thing.  

If I have a reactor:

a
  -> b
  -> c

And b configures a plugin with dependency foo, and c configures the same 
plugin, but with dependency bar, if I run mvn in "c", it works fine (gets 
bar), but if I run from a, it doesn't work right in c.   It just gets foo.   
Thus, it works differently depending on where I type "mvn".   To me, that is 
bad.

Other than remote resources, the other plugin I've hit this time and time 
again is antrun.     In the above, if (b) just uses antrun without any 
dependencies to do basic things, but (c) requires the trax dependencies for 
xslt processing, you have to configure the trax in (b) as well, which is 
stupid.  (yes, the proper thing is to configure in pluginManagement in a, but 
my point is the same, the current behavior yields different results depending 
on where it's run)


........
> > We either need the bug in maven fixed (and on 2.0.x) or we need this
> > fixed or
> > we just say Apache parent is useless for us.   We've BEEN saying
> > Apache parent
> > is useless, but I want to change that.
> 
> Or how about changing the facility in the RR plugin? You need to
> specify resources bundles and supplemental models. So if the plugin
> took care of the loading of these elements that would be more self-
> contained.

 
Umm..  that's exactly what the commit does.   It adds configuration for 
artifacts to look in for the supplemental models.  That way, it's not a 
"dependency" thing, it's a configuration thing..    It works exactly (shares 
the same code) as the configuration for the resource-bundles itself.

> I partially understand. Just not too comfortable with changes made for  
> specific projects like CXF when I haven't seen the use case crop up  
> anywhere else.

Quite possibly because few projects use the supplemental models.   CXF has a 
very broad set of dependencies and a lot of them have crappy poms that need 
the supplements.   Personally, I'd love to have the deploy plugin updated to 
refuse to deploy poms that don't have the basic bits of information (name, 
url, licenses, organization, etc...), but users probably wouldn't like that 
and it doesn't solve the problem of artifacts not built with maven.

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r810121 - in /maven/plugins/trunk/maven-remote-resources-plugin/src: main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java

Posted by Jason van Zyl <jv...@sonatype.com>.
On 2009-09-01, at 7:22 PM, Daniel Kulp wrote:

> On Tue September 1 2009 12:58:52 pm Jason van Zyl wrote:
>> I can't tell from the issue what it is exactly you're trying to
>> accomplish?
>
> Well, the "goal" is to eventually be able to use the Apache parent  
> pom for
> CXF.   Right now, we cannot.
>
> We have to be able to specify different supplemental models in  
> different parts
> of the maven build.   Example:  the first module in our reactor is our
> buildtools module that actually packages up the supplemental models  
> into a jar
> that the rest of the build then uses.
>
> To load it in the other modules, we currently have to have a direct  
> dependency
> on the buildtools module:
> <plugin>
>               <artifactId>maven-remote-resources-plugin</artifactId>
>               <dependencies>
>                   <dependency>
>                       <groupId>org.apache.cxf</groupId>
>                       <artifactId>cxf-buildtools</artifactId>
>                       <version>${project.version}</version>
>                   </dependency>
>               </dependencies>
> ....
>
>
> However, to accomplish that, we HAVE to make sure the remote- 
> resources is NOT
> loaded in buildtools.   Otherwise, due to the bug in maven that  
> doesn't re-
> evaluate plugin dependencies after the first load, the subsequent  
> modules
> would not be able to get the supplements.

Why would we want to revaluate the dependencies after the first load?  
This is actually very expensive especially with respect to IDE  
integration. In M2Eclipse we had to make a lot of changes to try and  
make this efficient. Re-reading dependencies is not something I would  
see being useful -- unless of course you actually change them. It's  
not a reactor problem you're having?

>  When we use the Apache parent,
> buildtools ends up with remote-resources running and then all the  
> rest of the
> remote-resources invokations break.
>
> The goal is basically to make it so we don't need to have a direct  
> dependency
> on the artifact.   We DON'T currently need a direct dependency on  
> the artifact
> for the actual resource bundle, why do we need one for the  
> supplements?
> That's what it fixes.
>
> We either need the bug in maven fixed (and on 2.0.x) or we need this  
> fixed or
> we just say Apache parent is useless for us.   We've BEEN saying  
> Apache parent
> is useless, but I want to change that.

Or how about changing the facility in the RR plugin? You need to  
specify resources bundles and supplemental models. So if the plugin  
took care of the loading of these elements that would be more self- 
contained.

>
> Does that answer the question?
>

I partially understand. Just not too comfortable with changes made for  
specific projects like CXF when I haven't seen the use case crop up  
anywhere else.

> Dan
>
>
>
>> On 2009-09-01, at 11:55 AM, dkulp@apache.org wrote:
>>> Author: dkulp
>>> Date: Tue Sep  1 16:55:14 2009
>>> New Revision: 810121
>>>
>>> URL: http://svn.apache.org/viewvc?rev=810121&view=rev
>>> Log:
>>> [MRRESOURCES-43] Add ability to load supplimental models from remote
>>> artifacts and not direct dependencies of the plugin
>>>
>>> Modified:
>>>  maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/
>>> org/apache/maven/plugin/resources/remote/
>>> ProcessRemoteResourcesMojo.java
>>>  maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/
>>> org/apache/maven/plugin/resources/remote/ 
>>> RemoteResourcesMojoTest.java
>>>
>>> Modified: maven/plugins/trunk/maven-remote-resources-plugin/src/ 
>>> main/
>>> java/org/apache/maven/plugin/resources/remote/
>>> ProcessRemoteResourcesMojo.java
>>> URL:
>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-p
>>> lugin/src/main/java/org/apache/maven/plugin/resources/remote/ 
>>> ProcessRemote
>>> ResourcesMojo.java?rev=810121&r1=810120&r2=810121&view=diff =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> = 
>>> ====================================================================
>>> --- maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/
>>> org/apache/maven/plugin/resources/remote/
>>> ProcessRemoteResourcesMojo.java (original)
>>> +++ maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/
>>> org/apache/maven/plugin/resources/remote/
>>> ProcessRemoteResourcesMojo.java Tue Sep  1 16:55:14 2009
>>> @@ -237,9 +237,19 @@
>>>   private String[] supplementalModels;
>>>
>>>   /**
>>> +     * List of artifacts that are added to the search path when
>>> looking
>>> +     * for supplementalModels
>>> +     * @parameter
>>> +     * @since 1.1
>>> +     */
>>> +    private List supplementalModelArtifacts;
>>> +
>>> +    /**
>>>    * Map of artifacts to supplemental project object models.
>>>    */
>>>   private Map supplementModels;
>>> +
>>> +
>>>
>>>   /**
>>>    * Merges supplemental data model with artifact
>>> @@ -269,7 +279,7 @@
>>>   private boolean skip;
>>>
>>>   /**
>>> -     * Skip remote-resource processing
>>> +     * Attaches the resource to the project as a resource directory
>>>    *
>>>    * @parameter default-value="true"
>>>    * @since 1.0-beta-1
>>> @@ -466,6 +476,7 @@
>>>           }
>>>       }
>>>
>>> +        addSupplementalModelArtifacts();
>>>       locator.addSearchPath( FileResourceLoader.ID, project.getFile
>>> ().getParentFile().getAbsolutePath() );
>>>       if ( appendedResourcesDirectory != null )
>>>       {
>>> @@ -481,7 +492,7 @@
>>>
>>>           validate();
>>>
>>> -            List resourceBundleArtifacts = downloadResourceBundles
>>> ( resourceBundles );
>>> +            List resourceBundleArtifacts = downloadBundles
>>> ( resourceBundles );
>>>           supplementModels = loadSupplements( supplementalModels );
>>>
>>>           VelocityContext context = new VelocityContext
>>> ( properties );
>>> @@ -531,6 +542,38 @@
>>>       }
>>>   }
>>>
>>> +    private void addSupplementalModelArtifacts() throws
>>> MojoExecutionException
>>> +    {
>>> +        if ( supplementalModelArtifacts != null && !
>>> supplementalModelArtifacts.isEmpty() )
>>> +        {
>>> +            List artifacts = downloadBundles
>>> ( supplementalModelArtifacts );
>>> +
>>> +            for ( Iterator i = artifacts.iterator(); i.hasNext(); )
>>> +            {
>>> +                File artifact = (File) i.next();
>>> +
>>> +                if ( artifact.isDirectory() )
>>> +                {
>>> +                    locator.addSearchPath( FileResourceLoader.ID,
>>> artifact.getAbsolutePath() );
>>> +                }
>>> +                else
>>> +                {
>>> +                    try
>>> +                    {
>>> +                        locator.addSearchPath( "jar", "jar:" +
>>> artifact.toURL().toExternalForm() );
>>> +                    }
>>> +                    catch (MalformedURLException e)
>>> +                    {
>>> +                        throw new MojoExecutionException( "Could
>>> not use jar "
>>> +                                                          +
>>> artifact.getAbsolutePath(), e );
>>> +                    }
>>> +                }
>>> +            }
>>> +
>>> +
>>> +        }
>>> +    }
>>> +
>>>   protected List getProjects()
>>>       throws MojoExecutionException
>>>   {
>>> @@ -925,24 +968,44 @@
>>>       }
>>>   }
>>>
>>> -    private List downloadResourceBundles( List resourceBundles )
>>> +    private List downloadBundles( List bundles )
>>>       throws MojoExecutionException
>>>   {
>>> -        List resourceBundleArtifacts = new ArrayList();
>>> +        List bundleArtifacts = new ArrayList();
>>>
>>>       try
>>>       {
>>> -            for ( Iterator i = resourceBundles.iterator();  
>>> i.hasNext
>>> (); )
>>> +            for ( Iterator i = bundles.iterator(); i.hasNext(); )
>>>           {
>>>               String artifactDescriptor = (String) i.next();
>>>               // groupId:artifactId:version
>>>               String[] s = artifactDescriptor.split( ":" );
>>> -                File artifact = downloader.download( s[0], s[1], s
>>> [2], localRepository,
>>> +                File artifact = null;
>>> +                //check if the artifact is part of the reactor
>>> +                if ( mavenSession != null )
>>> +                {
>>> +                    List list = mavenSession.getSortedProjects();
>>> +                    Iterator it = list.iterator();
>>> +                    while ( it.hasNext() )
>>> +                    {
>>> +                        MavenProject p = (MavenProject) it.next();
>>> +                        if ( s[0].equals( p.getGroupId() )
>>> +                            && s[1].equals( p.getArtifactId() )
>>> +                            && s[2].equals( p.getVersion() ) )
>>> +                        {
>>> +                            artifact = new File( p.getBuild
>>> ().getOutputDirectory() );
>>> +                        }
>>> +                    }
>>> +                }
>>> +                if ( artifact == null || !artifact.exists() )
>>> +                {
>>> +                    artifact = downloader.download( s[0], s[1], s
>>> [2], localRepository,
>>>
>>> ProjectUtils.buildArtifactRepositories( repositories,
>>>
>>>                  artifactRepositoryFactory ,
>>>
>>>                  mavenSession.getContainer () ) );
>>> +                }
>>>
>>> -                resourceBundleArtifacts.add( artifact );
>>> +                bundleArtifacts.add( artifact );
>>>           }
>>>       }
>>>       catch ( DownloadException e )
>>> @@ -958,7 +1021,7 @@
>>>           throw new MojoExecutionException( "Resources JAR cannot
>>> be found.", e );
>>>       }
>>>
>>> -        return resourceBundleArtifacts;
>>> +        return bundleArtifacts;
>>>   }
>>>
>>>   private void initalizeClassloader( RemoteResourcesClassLoader
>>> cl, List artifacts )
>>>
>>> Modified: maven/plugins/trunk/maven-remote-resources-plugin/src/ 
>>> test/
>>> java/org/apache/maven/plugin/resources/remote/
>>> RemoteResourcesMojoTest.java
>>> URL:
>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-p
>>> lugin/src/test/java/org/apache/maven/plugin/resources/remote/ 
>>> RemoteResourc
>>> esMojoTest.java?rev=810121&r1=810120&r2=810121&view=diff =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> = 
>>> ====================================================================
>>> --- maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/
>>> org/apache/maven/plugin/resources/remote/
>>> RemoteResourcesMojoTest.java (original)
>>> +++ maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/
>>> org/apache/maven/plugin/resources/remote/
>>> RemoteResourcesMojoTest.java Tue Sep  1 16:55:14 2009
>>> @@ -24,6 +24,7 @@
>>> import org.apache.maven.artifact.repository.ArtifactRepository;
>>> import org.apache.maven.artifact.versioning.VersionRange;
>>> import org.apache.maven.execution.MavenSession;
>>> +import org.apache.maven.execution.ReactorManager;
>>> import
>>> org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub
>>> ;
>>> import org.apache.maven.plugin.testing.AbstractMojoTestCase;
>>> import org.apache.maven.project.MavenProject;
>>> @@ -385,7 +386,7 @@
>>>                                   null, //Settings settings,
>>>                                   null, //ArtifactRepository
>>> localRepository,
>>>                                   null, //EventDispatcher
>>> eventDispatcher,
>>> -                                    null, //ReactorManager
>>> reactorManager,
>>> +                                    new ReactorManager(new  
>>> ArrayList
>>> ()),
>>>                                   Arrays.asList( new String[]
>>> {"install"} ),
>>>                                   project.getBasedir().toString(),
>>>                                   new Properties(),
>>
>> Thanks,
>>
>> Jason
>>
>> ----------------------------------------------------------
>> Jason van Zyl
>> Founder,  Apache Maven
>> http://twitter.com/jvanzyl
>> http://twitter.com/SonatypeNexus
>> http://twitter.com/SonatypeM2E
>> ----------------------------------------------------------
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
http://twitter.com/SonatypeNexus
http://twitter.com/SonatypeM2E
----------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r810121 - in /maven/plugins/trunk/maven-remote-resources-plugin/src: main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java

Posted by Daniel Kulp <dk...@apache.org>.
On Tue September 1 2009 12:58:52 pm Jason van Zyl wrote:
> I can't tell from the issue what it is exactly you're trying to
> accomplish?

Well, the "goal" is to eventually be able to use the Apache parent pom for 
CXF.   Right now, we cannot.   

We have to be able to specify different supplemental models in different parts 
of the maven build.   Example:  the first module in our reactor is our 
buildtools module that actually packages up the supplemental models into a jar 
that the rest of the build then uses.

To load it in the other modules, we currently have to have a direct dependency 
on the buildtools module:
<plugin>
                <artifactId>maven-remote-resources-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.cxf</groupId>
                        <artifactId>cxf-buildtools</artifactId>
                        <version>${project.version}</version>
                    </dependency>
                </dependencies>
....


However, to accomplish that, we HAVE to make sure the remote-resources is NOT 
loaded in buildtools.   Otherwise, due to the bug in maven that doesn't re-
evaluate plugin dependencies after the first load, the subsequent modules 
would not be able to get the supplements.    When we use the Apache parent, 
buildtools ends up with remote-resources running and then all the rest of the 
remote-resources invokations break.

The goal is basically to make it so we don't need to have a direct dependency 
on the artifact.   We DON'T currently need a direct dependency on the artifact 
for the actual resource bundle, why do we need one for the supplements?  
That's what it fixes.   

We either need the bug in maven fixed (and on 2.0.x) or we need this fixed or 
we just say Apache parent is useless for us.   We've BEEN saying Apache parent 
is useless, but I want to change that.

Does that answer the question?

Dan



> On 2009-09-01, at 11:55 AM, dkulp@apache.org wrote:
> > Author: dkulp
> > Date: Tue Sep  1 16:55:14 2009
> > New Revision: 810121
> >
> > URL: http://svn.apache.org/viewvc?rev=810121&view=rev
> > Log:
> > [MRRESOURCES-43] Add ability to load supplimental models from remote
> > artifacts and not direct dependencies of the plugin
> >
> > Modified:
> >    maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/
> > org/apache/maven/plugin/resources/remote/
> > ProcessRemoteResourcesMojo.java
> >    maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/
> > org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java
> >
> > Modified: maven/plugins/trunk/maven-remote-resources-plugin/src/main/
> > java/org/apache/maven/plugin/resources/remote/
> > ProcessRemoteResourcesMojo.java
> > URL:
> > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-p
> >lugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemote
> >ResourcesMojo.java?rev=810121&r1=810120&r2=810121&view=diff =
> > =
> > =
> > =
> > =
> > =
> > =
> > =
> > ======================================================================
> > --- maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/
> > org/apache/maven/plugin/resources/remote/
> > ProcessRemoteResourcesMojo.java (original)
> > +++ maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/
> > org/apache/maven/plugin/resources/remote/
> > ProcessRemoteResourcesMojo.java Tue Sep  1 16:55:14 2009
> > @@ -237,9 +237,19 @@
> >     private String[] supplementalModels;
> >
> >     /**
> > +     * List of artifacts that are added to the search path when
> > looking
> > +     * for supplementalModels
> > +     * @parameter
> > +     * @since 1.1
> > +     */
> > +    private List supplementalModelArtifacts;
> > +
> > +    /**
> >      * Map of artifacts to supplemental project object models.
> >      */
> >     private Map supplementModels;
> > +
> > +
> >
> >     /**
> >      * Merges supplemental data model with artifact
> > @@ -269,7 +279,7 @@
> >     private boolean skip;
> >
> >     /**
> > -     * Skip remote-resource processing
> > +     * Attaches the resource to the project as a resource directory
> >      *
> >      * @parameter default-value="true"
> >      * @since 1.0-beta-1
> > @@ -466,6 +476,7 @@
> >             }
> >         }
> >
> > +        addSupplementalModelArtifacts();
> >         locator.addSearchPath( FileResourceLoader.ID, project.getFile
> > ().getParentFile().getAbsolutePath() );
> >         if ( appendedResourcesDirectory != null )
> >         {
> > @@ -481,7 +492,7 @@
> >
> >             validate();
> >
> > -            List resourceBundleArtifacts = downloadResourceBundles
> > ( resourceBundles );
> > +            List resourceBundleArtifacts = downloadBundles
> > ( resourceBundles );
> >             supplementModels = loadSupplements( supplementalModels );
> >
> >             VelocityContext context = new VelocityContext
> > ( properties );
> > @@ -531,6 +542,38 @@
> >         }
> >     }
> >
> > +    private void addSupplementalModelArtifacts() throws
> > MojoExecutionException
> > +    {
> > +        if ( supplementalModelArtifacts != null && !
> > supplementalModelArtifacts.isEmpty() )
> > +        {
> > +            List artifacts = downloadBundles
> > ( supplementalModelArtifacts );
> > +
> > +            for ( Iterator i = artifacts.iterator(); i.hasNext(); )
> > +            {
> > +                File artifact = (File) i.next();
> > +
> > +                if ( artifact.isDirectory() )
> > +                {
> > +                    locator.addSearchPath( FileResourceLoader.ID,
> > artifact.getAbsolutePath() );
> > +                }
> > +                else
> > +                {
> > +                    try
> > +                    {
> > +                        locator.addSearchPath( "jar", "jar:" +
> > artifact.toURL().toExternalForm() );
> > +                    }
> > +                    catch (MalformedURLException e)
> > +                    {
> > +                        throw new MojoExecutionException( "Could
> > not use jar "
> > +                                                          +
> > artifact.getAbsolutePath(), e );
> > +                    }
> > +                }
> > +            }
> > +
> > +
> > +        }
> > +    }
> > +
> >     protected List getProjects()
> >         throws MojoExecutionException
> >     {
> > @@ -925,24 +968,44 @@
> >         }
> >     }
> >
> > -    private List downloadResourceBundles( List resourceBundles )
> > +    private List downloadBundles( List bundles )
> >         throws MojoExecutionException
> >     {
> > -        List resourceBundleArtifacts = new ArrayList();
> > +        List bundleArtifacts = new ArrayList();
> >
> >         try
> >         {
> > -            for ( Iterator i = resourceBundles.iterator(); i.hasNext
> > (); )
> > +            for ( Iterator i = bundles.iterator(); i.hasNext(); )
> >             {
> >                 String artifactDescriptor = (String) i.next();
> >                 // groupId:artifactId:version
> >                 String[] s = artifactDescriptor.split( ":" );
> > -                File artifact = downloader.download( s[0], s[1], s
> > [2], localRepository,
> > +                File artifact = null;
> > +                //check if the artifact is part of the reactor
> > +                if ( mavenSession != null )
> > +                {
> > +                    List list = mavenSession.getSortedProjects();
> > +                    Iterator it = list.iterator();
> > +                    while ( it.hasNext() )
> > +                    {
> > +                        MavenProject p = (MavenProject) it.next();
> > +                        if ( s[0].equals( p.getGroupId() )
> > +                            && s[1].equals( p.getArtifactId() )
> > +                            && s[2].equals( p.getVersion() ) )
> > +                        {
> > +                            artifact = new File( p.getBuild
> > ().getOutputDirectory() );
> > +                        }
> > +                    }
> > +                }
> > +                if ( artifact == null || !artifact.exists() )
> > +                {
> > +                    artifact = downloader.download( s[0], s[1], s
> > [2], localRepository,
> >
> > ProjectUtils.buildArtifactRepositories( repositories,
> >                                                                          
> >                    artifactRepositoryFactory ,
> >                                                                          
> >                    mavenSession.getContainer () ) );
> > +                }
> >
> > -                resourceBundleArtifacts.add( artifact );
> > +                bundleArtifacts.add( artifact );
> >             }
> >         }
> >         catch ( DownloadException e )
> > @@ -958,7 +1021,7 @@
> >             throw new MojoExecutionException( "Resources JAR cannot
> > be found.", e );
> >         }
> >
> > -        return resourceBundleArtifacts;
> > +        return bundleArtifacts;
> >     }
> >
> >     private void initalizeClassloader( RemoteResourcesClassLoader
> > cl, List artifacts )
> >
> > Modified: maven/plugins/trunk/maven-remote-resources-plugin/src/test/
> > java/org/apache/maven/plugin/resources/remote/
> > RemoteResourcesMojoTest.java
> > URL:
> > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-p
> >lugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourc
> >esMojoTest.java?rev=810121&r1=810120&r2=810121&view=diff =
> > =
> > =
> > =
> > =
> > =
> > =
> > =
> > ======================================================================
> > --- maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/
> > org/apache/maven/plugin/resources/remote/
> > RemoteResourcesMojoTest.java (original)
> > +++ maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/
> > org/apache/maven/plugin/resources/remote/
> > RemoteResourcesMojoTest.java Tue Sep  1 16:55:14 2009
> > @@ -24,6 +24,7 @@
> > import org.apache.maven.artifact.repository.ArtifactRepository;
> > import org.apache.maven.artifact.versioning.VersionRange;
> > import org.apache.maven.execution.MavenSession;
> > +import org.apache.maven.execution.ReactorManager;
> > import
> > org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub
> > ;
> > import org.apache.maven.plugin.testing.AbstractMojoTestCase;
> > import org.apache.maven.project.MavenProject;
> > @@ -385,7 +386,7 @@
> >                                     null, //Settings settings,
> >                                     null, //ArtifactRepository
> > localRepository,
> >                                     null, //EventDispatcher
> > eventDispatcher,
> > -                                    null, //ReactorManager
> > reactorManager,
> > +                                    new ReactorManager(new ArrayList
> > ()),
> >                                     Arrays.asList( new String[]
> > {"install"} ),
> >                                     project.getBasedir().toString(),
> >                                     new Properties(),
>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> http://twitter.com/SonatypeNexus
> http://twitter.com/SonatypeM2E
> ----------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r810121 - in /maven/plugins/trunk/maven-remote-resources-plugin/src: main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java

Posted by Jason van Zyl <jv...@sonatype.com>.
I can't tell from the issue what it is exactly you're trying to  
accomplish?

On 2009-09-01, at 11:55 AM, dkulp@apache.org wrote:

> Author: dkulp
> Date: Tue Sep  1 16:55:14 2009
> New Revision: 810121
>
> URL: http://svn.apache.org/viewvc?rev=810121&view=rev
> Log:
> [MRRESOURCES-43] Add ability to load supplimental models from remote
> artifacts and not direct dependencies of the plugin
>
> Modified:
>    maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/ 
> org/apache/maven/plugin/resources/remote/ 
> ProcessRemoteResourcesMojo.java
>    maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/ 
> org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java
>
> Modified: maven/plugins/trunk/maven-remote-resources-plugin/src/main/ 
> java/org/apache/maven/plugin/resources/remote/ 
> ProcessRemoteResourcesMojo.java
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java?rev=810121&r1=810120&r2=810121&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/ 
> org/apache/maven/plugin/resources/remote/ 
> ProcessRemoteResourcesMojo.java (original)
> +++ maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/ 
> org/apache/maven/plugin/resources/remote/ 
> ProcessRemoteResourcesMojo.java Tue Sep  1 16:55:14 2009
> @@ -237,9 +237,19 @@
>     private String[] supplementalModels;
>
>     /**
> +     * List of artifacts that are added to the search path when  
> looking
> +     * for supplementalModels
> +     * @parameter
> +     * @since 1.1
> +     */
> +    private List supplementalModelArtifacts;
> +
> +    /**
>      * Map of artifacts to supplemental project object models.
>      */
>     private Map supplementModels;
> +
> +
>
>     /**
>      * Merges supplemental data model with artifact
> @@ -269,7 +279,7 @@
>     private boolean skip;
>
>     /**
> -     * Skip remote-resource processing
> +     * Attaches the resource to the project as a resource directory
>      *
>      * @parameter default-value="true"
>      * @since 1.0-beta-1
> @@ -466,6 +476,7 @@
>             }
>         }
>
> +        addSupplementalModelArtifacts();
>         locator.addSearchPath( FileResourceLoader.ID, project.getFile 
> ().getParentFile().getAbsolutePath() );
>         if ( appendedResourcesDirectory != null )
>         {
> @@ -481,7 +492,7 @@
>
>             validate();
>
> -            List resourceBundleArtifacts = downloadResourceBundles 
> ( resourceBundles );
> +            List resourceBundleArtifacts = downloadBundles 
> ( resourceBundles );
>             supplementModels = loadSupplements( supplementalModels );
>
>             VelocityContext context = new VelocityContext 
> ( properties );
> @@ -531,6 +542,38 @@
>         }
>     }
>
> +    private void addSupplementalModelArtifacts() throws  
> MojoExecutionException
> +    {
> +        if ( supplementalModelArtifacts != null && ! 
> supplementalModelArtifacts.isEmpty() )
> +        {
> +            List artifacts = downloadBundles 
> ( supplementalModelArtifacts );
> +
> +            for ( Iterator i = artifacts.iterator(); i.hasNext(); )
> +            {
> +                File artifact = (File) i.next();
> +
> +                if ( artifact.isDirectory() )
> +                {
> +                    locator.addSearchPath( FileResourceLoader.ID,  
> artifact.getAbsolutePath() );
> +                }
> +                else
> +                {
> +                    try
> +                    {
> +                        locator.addSearchPath( "jar", "jar:" +  
> artifact.toURL().toExternalForm() );
> +                    }
> +                    catch (MalformedURLException e)
> +                    {
> +                        throw new MojoExecutionException( "Could  
> not use jar "
> +                                                          +  
> artifact.getAbsolutePath(), e );
> +                    }
> +                }
> +            }
> +
> +
> +        }
> +    }
> +
>     protected List getProjects()
>         throws MojoExecutionException
>     {
> @@ -925,24 +968,44 @@
>         }
>     }
>
> -    private List downloadResourceBundles( List resourceBundles )
> +    private List downloadBundles( List bundles )
>         throws MojoExecutionException
>     {
> -        List resourceBundleArtifacts = new ArrayList();
> +        List bundleArtifacts = new ArrayList();
>
>         try
>         {
> -            for ( Iterator i = resourceBundles.iterator(); i.hasNext 
> (); )
> +            for ( Iterator i = bundles.iterator(); i.hasNext(); )
>             {
>                 String artifactDescriptor = (String) i.next();
>                 // groupId:artifactId:version
>                 String[] s = artifactDescriptor.split( ":" );
> -                File artifact = downloader.download( s[0], s[1], s 
> [2], localRepository,
> +                File artifact = null;
> +                //check if the artifact is part of the reactor
> +                if ( mavenSession != null )
> +                {
> +                    List list = mavenSession.getSortedProjects();
> +                    Iterator it = list.iterator();
> +                    while ( it.hasNext() )
> +                    {
> +                        MavenProject p = (MavenProject) it.next();
> +                        if ( s[0].equals( p.getGroupId() )
> +                            && s[1].equals( p.getArtifactId() )
> +                            && s[2].equals( p.getVersion() ) )
> +                        {
> +                            artifact = new File( p.getBuild 
> ().getOutputDirectory() );
> +                        }
> +                    }
> +                }
> +                if ( artifact == null || !artifact.exists() )
> +                {
> +                    artifact = downloader.download( s[0], s[1], s 
> [2], localRepository,
>                                                       
> ProjectUtils.buildArtifactRepositories( repositories,
>                                                                                              artifactRepositoryFactory 
> ,
>                                                                                              mavenSession.getContainer 
> () ) );
> +                }
>
> -                resourceBundleArtifacts.add( artifact );
> +                bundleArtifacts.add( artifact );
>             }
>         }
>         catch ( DownloadException e )
> @@ -958,7 +1021,7 @@
>             throw new MojoExecutionException( "Resources JAR cannot  
> be found.", e );
>         }
>
> -        return resourceBundleArtifacts;
> +        return bundleArtifacts;
>     }
>
>     private void initalizeClassloader( RemoteResourcesClassLoader  
> cl, List artifacts )
>
> Modified: maven/plugins/trunk/maven-remote-resources-plugin/src/test/ 
> java/org/apache/maven/plugin/resources/remote/ 
> RemoteResourcesMojoTest.java
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java?rev=810121&r1=810120&r2=810121&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/ 
> org/apache/maven/plugin/resources/remote/ 
> RemoteResourcesMojoTest.java (original)
> +++ maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/ 
> org/apache/maven/plugin/resources/remote/ 
> RemoteResourcesMojoTest.java Tue Sep  1 16:55:14 2009
> @@ -24,6 +24,7 @@
> import org.apache.maven.artifact.repository.ArtifactRepository;
> import org.apache.maven.artifact.versioning.VersionRange;
> import org.apache.maven.execution.MavenSession;
> +import org.apache.maven.execution.ReactorManager;
> import  
> org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub 
> ;
> import org.apache.maven.plugin.testing.AbstractMojoTestCase;
> import org.apache.maven.project.MavenProject;
> @@ -385,7 +386,7 @@
>                                     null, //Settings settings,
>                                     null, //ArtifactRepository  
> localRepository,
>                                     null, //EventDispatcher  
> eventDispatcher,
> -                                    null, //ReactorManager  
> reactorManager,
> +                                    new ReactorManager(new ArrayList 
> ()),
>                                     Arrays.asList( new String[]  
> {"install"} ),
>                                     project.getBasedir().toString(),
>                                     new Properties(),
>
>

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
http://twitter.com/SonatypeNexus
http://twitter.com/SonatypeM2E
----------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org