Flatten resource location on copy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Flatten resource location on copy

Jamie Bisotti
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Flatten resource location on copy

Jamie Bisotti
Anyone???

On 5/24/05, Jamie Bisotti <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Flatten resource location on copy

Brett Porter
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 <[hidden email]> wrote:

> Anyone???
>
> On 5/24/05, Jamie Bisotti <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]