You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jamie Bisotti <jb...@gmail.com> on 2005/05/24 16:25:45 UTC

Flatten resource location on copy

My source tree looks like the following:
   src/conf/foo1/blah1.properties
   src/conf/foo2/blah2.properties
   ...
   src/conf/fooN/blahN.properties
...

and I'd like for the target tree to look like the following:
   target/classes/blah1.properties
   target/classes/blah2.properties
   ...
   target/classes/blahN.properties

I could do it with multiple <resource> elements, like this:
  <resource>
    <directory>${basedir}/src/conf/foo1</directory>
    <includes>
      <include>*.properties</include>
    </includes>
  </resource>
  ...
  <resource>
    <directory>${basedir}/src/conf/fooN</directory>
    <includes>
      <include>*.properties</include>
    </includes>
  </resource>

but, there will be a lot of "foo" subdirectories and I'd like not to
have to add 6 lines for each one to my project.xml.  So, I tried the
following:

  <resource>
    <directory>${basedir}/src/conf</directory>
    <includes>
      <include>**/*.properties</include>
    </includes>
  </resource>

However, this creates target/classes/fooN/blahN.properties.

So, is there a way to "flatten"/lose the directory structure on the
resource copy?  I didn't go look it up, but I'm pretty sure Ant
provides a way to do that.  If it isn't currently possible, does
anyone think it might make a good enhancement?

-- 
Jamie Bisotti
Software Engineer
Lexmark International, Inc.

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


Re: Flatten resource location on copy

Posted by Brett Porter <br...@gmail.com>.
I'm not sure if it is a good general enhancements (feel free to
convince me with reasons otherwise).

For your current situation you will have to go with a custom maven.xml
that uses ant:copy with a flatten mapper.

Cheers,
Brett

On 5/26/05, Jamie Bisotti <jb...@gmail.com> wrote:
> Anyone???
> 
> On 5/24/05, Jamie Bisotti <jb...@gmail.com> wrote:
> > My source tree looks like the following:
> >    src/conf/foo1/blah1.properties
> >    src/conf/foo2/blah2.properties
> >    ...
> >    src/conf/fooN/blahN.properties
> > ...
> >
> > and I'd like for the target tree to look like the following:
> >    target/classes/blah1.properties
> >    target/classes/blah2.properties
> >    ...
> >    target/classes/blahN.properties
> >
> > I could do it with multiple <resource> elements, like this:
> >   <resource>
> >     <directory>${basedir}/src/conf/foo1</directory>
> >     <includes>
> >       <include>*.properties</include>
> >     </includes>
> >   </resource>
> >   ...
> >   <resource>
> >     <directory>${basedir}/src/conf/fooN</directory>
> >     <includes>
> >       <include>*.properties</include>
> >     </includes>
> >   </resource>
> >
> > but, there will be a lot of "foo" subdirectories and I'd like not to
> > have to add 6 lines for each one to my project.xml.  So, I tried the
> > following:
> >
> >   <resource>
> >     <directory>${basedir}/src/conf</directory>
> >     <includes>
> >       <include>**/*.properties</include>
> >     </includes>
> >   </resource>
> >
> > However, this creates target/classes/fooN/blahN.properties.
> >
> > So, is there a way to "flatten"/lose the directory structure on the
> > resource copy?  I didn't go look it up, but I'm pretty sure Ant
> > provides a way to do that.  If it isn't currently possible, does
> > anyone think it might make a good enhancement?
> >
> > --
> > Jamie Bisotti
> > Software Engineer
> > Lexmark International, Inc.
> >
> 
> 
> --
> Jamie Bisotti
> Software Engineer
> Lexmark International, Inc.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
>

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


Re: Flatten resource location on copy

Posted by Jamie Bisotti <jb...@gmail.com>.
Anyone???

On 5/24/05, Jamie Bisotti <jb...@gmail.com> wrote:
> My source tree looks like the following:
>    src/conf/foo1/blah1.properties
>    src/conf/foo2/blah2.properties
>    ...
>    src/conf/fooN/blahN.properties
> ...
> 
> and I'd like for the target tree to look like the following:
>    target/classes/blah1.properties
>    target/classes/blah2.properties
>    ...
>    target/classes/blahN.properties
> 
> I could do it with multiple <resource> elements, like this:
>   <resource>
>     <directory>${basedir}/src/conf/foo1</directory>
>     <includes>
>       <include>*.properties</include>
>     </includes>
>   </resource>
>   ...
>   <resource>
>     <directory>${basedir}/src/conf/fooN</directory>
>     <includes>
>       <include>*.properties</include>
>     </includes>
>   </resource>
> 
> but, there will be a lot of "foo" subdirectories and I'd like not to
> have to add 6 lines for each one to my project.xml.  So, I tried the
> following:
> 
>   <resource>
>     <directory>${basedir}/src/conf</directory>
>     <includes>
>       <include>**/*.properties</include>
>     </includes>
>   </resource>
> 
> However, this creates target/classes/fooN/blahN.properties.
> 
> So, is there a way to "flatten"/lose the directory structure on the
> resource copy?  I didn't go look it up, but I'm pretty sure Ant
> provides a way to do that.  If it isn't currently possible, does
> anyone think it might make a good enhancement?
> 
> --
> Jamie Bisotti
> Software Engineer
> Lexmark International, Inc.
> 


-- 
Jamie Bisotti
Software Engineer
Lexmark International, Inc.

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