You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Bill Shannon <bi...@oracle.com> on 2011/08/11 00:54:23 UTC

iterating over resources in mojo

I'm writing a maven plugin.  (2.2.1, if it matters.)  I can get all the
Resource objects for a project.  The Resources might have includes or
excludes specified.  How do I iterate over all the resource files,
taking into account the includes and excludes?  I was hoping the Resource
or FileSet class would provide an iterator to accomplish this.  I'm sure
there must be a method to do this, I just don't know where to look for it.

Thanks.

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


Re: iterating over resources in mojo

Posted by Bill Shannon <bi...@oracle.com>.
FileUtils.getFiles takes the includes as a comma separated list.
Resource.getIncludes returns the includes as a List<String>.
There seems to be an impedance mismatch here.  Do I need to
convert the List into a comma separated String?  Do I just
assume there are no commas in the pattern, or is there a way
to escape them?  Is there a convenience method to do that?

Also, since there's both getFileNames and getFileAndDirectoryNames,
I assume the former will *never* return the name of a directory?
(The documentation is a bit on the terse side.)

Thanks.


Robert Scholte wrote on 08/11/2011 10:00 AM:
>
> See http://plexus.codehaus.org/plexus-utils/apidocs/org/codehaus/plexus/util/FileUtils.html
>
> getFiles(), getFileNames(), getFileAndDirectoryNames()
>
>
> -Robert
>
> ----------------------------------------
>> Date: Thu, 11 Aug 2011 08:02:01 +0200
>> Subject: Re: iterating over resources in mojo
>> From: anders@hammar.net
>> To: dev@maven.apache.org
>>
>> I don't have the answer, but I would look in the maven-resources-plugin
>> source to see how it is done there.
>>
>> /Anders
>>
>> On Thu, Aug 11, 2011 at 00:54, Bill Shannon<bi...@oracle.com>  wrote:
>>
>>> I'm writing a maven plugin. (2.2.1, if it matters.) I can get all the
>>> Resource objects for a project. The Resources might have includes or
>>> excludes specified. How do I iterate over all the resource files,
>>> taking into account the includes and excludes? I was hoping the Resource
>>> or FileSet class would provide an iterator to accomplish this. I'm sure
>>> there must be a method to do this, I just don't know where to look for it.
>>>
>>> Thanks.
>>>
>>> ------------------------------**------------------------------**---------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.**org<de...@maven.apache.org>
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>
>>> 		 	   		
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>


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


RE: iterating over resources in mojo

Posted by Robert Scholte <rf...@codehaus.org>.
See http://plexus.codehaus.org/plexus-utils/apidocs/org/codehaus/plexus/util/FileUtils.html

getFiles(), getFileNames(), getFileAndDirectoryNames()


-Robert

----------------------------------------
> Date: Thu, 11 Aug 2011 08:02:01 +0200
> Subject: Re: iterating over resources in mojo
> From: anders@hammar.net
> To: dev@maven.apache.org
>
> I don't have the answer, but I would look in the maven-resources-plugin
> source to see how it is done there.
>
> /Anders
>
> On Thu, Aug 11, 2011 at 00:54, Bill Shannon <bi...@oracle.com> wrote:
>
> > I'm writing a maven plugin. (2.2.1, if it matters.) I can get all the
> > Resource objects for a project. The Resources might have includes or
> > excludes specified. How do I iterate over all the resource files,
> > taking into account the includes and excludes? I was hoping the Resource
> > or FileSet class would provide an iterator to accomplish this. I'm sure
> > there must be a method to do this, I just don't know where to look for it.
> >
> > Thanks.
> >
> > ------------------------------**------------------------------**---------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.**org<de...@maven.apache.org>
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> > 		 	   		  
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: iterating over resources in mojo

Posted by Anders Hammar <an...@hammar.net>.
I don't have the answer, but I would look in the maven-resources-plugin
source to see how it is done there.

/Anders

On Thu, Aug 11, 2011 at 00:54, Bill Shannon <bi...@oracle.com> wrote:

> I'm writing a maven plugin.  (2.2.1, if it matters.)  I can get all the
> Resource objects for a project.  The Resources might have includes or
> excludes specified.  How do I iterate over all the resource files,
> taking into account the includes and excludes?  I was hoping the Resource
> or FileSet class would provide an iterator to accomplish this.  I'm sure
> there must be a method to do this, I just don't know where to look for it.
>
> Thanks.
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.**org<de...@maven.apache.org>
> For additional commands, e-mail: dev-help@maven.apache.org
>
>