> not really neat, but the filter instance hold by the 'resource' task > is bound to single directory (@source).
> I'd just like to ask if there is a better way.
Hopefully. This came up before, I had some ideas, and want to share it with you and see what you all think.
Option 1, we can use the include method to add another source directory, so you can do:
resources.include _("src/main/hbm")
That will copy the contents of the hbm directory into target/classes, and most times will do the right thing. But there is no way to copy a directory into target/classes, if you wanted to do something like resources.include_("src/images") it will copy the image files, not the images directory. You'd have to use the longer filter ... run for this.
Option 2, you need to copy files individually, so:
resources.include _("src/main/hbm/*")
Which unfortunately won't work some of the time. It will look for files in the hbm directory, but if the hbm directory doesn't already exist, it won't find any, and since hbm is not a target, it will not execute any task to create them. This will just be frustrating to use.
Option 3, add additional source directories using from, so:
resources.from _("src/main/hbm")
On the face of it, it looks similar to option 1, but there's a subtle difference in the way include/exclude are used. In option 1, include/exclude must point to the actual files (absolute paths) being included, excluded. Say I only want to copy jpg files (and skip png files). For option 1:
I'm leaning towards option 3 that will allow resources to copy files from more source directories, and retain the relative path include/exclude options.
Option 3 is exactly what I was looking for yesterday. In my opinion, this is the most comprehensible solution.
I like the way the resource directory is clearly identified with the 'from' method. Chained with include/exclude, it avoids ambiguity about the filter root directory.
On Jul 10, 7:59 pm, "Assaf Arkin" <a...@labnotes.org> wrote:
> > not really neat, but the filter instance hold by the 'resource' task > > is bound to single directory (@source).
> > I'd just like to ask if there is a better way.
> Hopefully. This came up before, I had some ideas, and want to share it with > you and see what you all think.
> Option 1, we can use the include method to add another source directory, so > you can do:
> resources.include _("src/main/hbm")
> That will copy the contents of the hbm directory into target/classes, and > most times will do the right thing. But there is no way to copy a directory > into target/classes, if you wanted to do something like > resources.include_("src/images") it will copy the image files, not the > images directory. > You'd have to use the longer filter ... run for this.
> Option 2, you need to copy files individually, so:
> resources.include _("src/main/hbm/*")
> Which unfortunately won't work some of the time. It will look for files in > the hbm directory, but if the hbm directory doesn't already exist, it won't > find any, and since hbm is not a target, it will not execute any task to > create them. This will just be frustrating to use.
> Option 3, add additional source directories using from, so:
> resources.from _("src/main/hbm")
> On the face of it, it looks similar to option 1, but there's a subtle > difference in the way include/exclude are used. In option 1, include/exclude > must point to the actual files (absolute paths) being included, excluded. > Say I only want to copy jpg files (and skip png files). For option 1:
> I'm leaning towards option 3 that will allow resources to copy files from > more source directories, and retain the relative path include/exclude > options.
I was dealing with this problem as well, and I think option 3 is the way to go. Just out of curiosity, if the include/exclude methods are not invoked, will all of the resources from the dir be copied by default?
For example;
resources.from( _("src-test") )
will Buildr recurse through the child directories of src-test and include all of the resources by default?
On Jul 11, 6:37 am, Alexis <alexismi...@gmail.com> wrote:
> Option 3 is exactly what I was looking for yesterday. > In my opinion, this is the most comprehensible solution.
> I like the way the resource directory is clearly identified with the > 'from' method. > Chained with include/exclude, it avoids ambiguity about the filter > root directory.
> On Jul 10, 7:59 pm, "Assaf Arkin" <a...@labnotes.org> wrote:
> > On 7/10/07, Alexis <alexismi...@gmail.com> wrote:
> > > Hey guys,
> > > for some reasons I'd like to keep my hbm files in a separate > > > directory. > > > So I need to add src/main/hbm to the list of resources.
> > > not really neat, but the filter instance hold by the 'resource' task > > > is bound to single directory (@source).
> > > I'd just like to ask if there is a better way.
> > Hopefully. This came up before, I had some ideas, and want to share it with > > you and see what you all think.
> > Option 1, we can use the include method to add another source directory, so > > you can do:
> > resources.include _("src/main/hbm")
> > That will copy the contents of the hbm directory into target/classes, and > > most times will do the right thing. But there is no way to copy a directory > > into target/classes, if you wanted to do something like > > resources.include_("src/images") it will copy the image files, not the > > images directory. > > You'd have to use the longer filter ... run for this.
> > Option 2, you need to copy files individually, so:
> > resources.include _("src/main/hbm/*")
> > Which unfortunately won't work some of the time. It will look for files in > > the hbm directory, but if the hbm directory doesn't already exist, it won't > > find any, and since hbm is not a target, it will not execute any task to > > create them. This will just be frustrating to use.
> > Option 3, add additional source directories using from, so:
> > resources.from _("src/main/hbm")
> > On the face of it, it looks similar to option 1, but there's a subtle > > difference in the way include/exclude are used. In option 1, include/exclude > > must point to the actual files (absolute paths) being included, excluded. > > Say I only want to copy jpg files (and skip png files). For option 1:
> > I'm leaning towards option 3 that will allow resources to copy files from > > more source directories, and retain the relative path include/exclude > > options.
For example I keep all my resources (spring, hibernate config etc.) in _("src/main/java") and as for me most intuitive way to add resource directory would be
resources.from( _("src/main/java") ).exclude("*.java") #copies all files (except source files) to _("target/classes")
On Jul 11, 4:59 pm, Caleb Powell <caleb.pow...@gmail.com> wrote:
> I was dealing with this problem as well, and I think option 3 is the > way to go. Just out of curiosity, if the include/exclude > methods are not invoked, will all of the resources from the dir be > copied by default?
> For example;
> resources.from( _("src-test") )
> will Buildr recurse through the child directories of src-test and > include all of the resources by default?
> For example I keep all my resources (spring, hibernate config etc.) in > _("src/main/java") and as for me most intuitive way to add resource > directory would be
> resources.from( _("src/main/java") ).exclude("*.java") #copies all > files (except source files) to _("target/classes")
> On Jul 11, 4:59 pm, Caleb Powell <caleb.pow...@gmail.com> wrote: > > I was dealing with this problem as well, and I think option 3 is the > > way to go. Just out of curiosity, if the include/exclude > > methods are not invoked, will all of the resources from the dir be > > copied by default?
> > For example;
> > resources.from( _("src-test") )
> > will Buildr recurse through the child directories of src-test and > > include all of the resources by default?
On 7/11/07, Caleb Powell <caleb.pow...@gmail.com> wrote:
> I was dealing with this problem as well, and I think option 3 is the > way to go. Just out of curiosity, if the include/exclude > methods are not invoked, will all of the resources from the dir be > copied by default?
I still have your e-mail, but I had to mentally work through all the combinations so it got pushed to after 1.2.
If you don't tell it which files to include, it defaults to "*", which processes all the files/directories in the source directory, and does so recursively. There's a default exclusion pattern, so it will always exclude the .svn and CVS directories, and all files ending with *.bak or ~.
The include/exclude pattern applies to all the source directories. In fact, the default behavior would just look for the src/main/resources directory, and if it exists, call from with it once for the resources task.
> will Buildr recurse through the child directories of src-test and > include all of the resources by default?
> On Jul 11, 6:37 am, Alexis <alexismi...@gmail.com> wrote: > > Option 3 is exactly what I was looking for yesterday. > > In my opinion, this is the most comprehensible solution.
> > I like the way the resource directory is clearly identified with the > > 'from' method. > > Chained with include/exclude, it avoids ambiguity about the filter > > root directory.
> > > On 7/10/07, Alexis <alexismi...@gmail.com> wrote:
> > > > Hey guys,
> > > > for some reasons I'd like to keep my hbm files in a separate > > > > directory. > > > > So I need to add src/main/hbm to the list of resources.
> > > > not really neat, but the filter instance hold by the 'resource' task > > > > is bound to single directory (@source).
> > > > I'd just like to ask if there is a better way.
> > > Hopefully. This came up before, I had some ideas, and want to share it > with > > > you and see what you all think.
> > > Option 1, we can use the include method to add another source > directory, so > > > you can do:
> > > resources.include _("src/main/hbm")
> > > That will copy the contents of the hbm directory into target/classes, > and > > > most times will do the right thing. But there is no way to copy a > directory > > > into target/classes, if you wanted to do something like > > > resources.include_("src/images") it will copy the image files, not the > > > images directory. > > > You'd have to use the longer filter ... run for this.
> > > Option 2, you need to copy files individually, so:
> > > resources.include _("src/main/hbm/*")
> > > Which unfortunately won't work some of the time. It will look for > files in > > > the hbm directory, but if the hbm directory doesn't already exist, it > won't > > > find any, and since hbm is not a target, it will not execute any task > to > > > create them. This will just be frustrating to use.
> > > Option 3, add additional source directories using from, so:
> > > resources.from _("src/main/hbm")
> > > On the face of it, it looks similar to option 1, but there's a subtle > > > difference in the way include/exclude are used. In option 1, > include/exclude > > > must point to the actual files (absolute paths) being included, > excluded. > > > Say I only want to copy jpg files (and skip png files). For option 1:
> > > I'm leaning towards option 3 that will allow resources to copy files > from > > > more source directories, and retain the relative path include/exclude > > > options.
> On 7/11/07, Caleb Powell <caleb.pow...@gmail.com> wrote:
> > I was dealing with this problem as well, and I think option 3 is the > > way to go. Just out of curiosity, if the include/exclude > > methods are not invoked, will all of the resources from the dir be > > copied by default?
> I still have your e-mail, but I had to mentally work through all the > combinations so it got pushed to after 1.2.
> If you don't tell it which files to include, it defaults to "*", which > processes all the files/directories in the source directory, and does so > recursively. There's a default exclusion pattern, so it will always exclude > the .svn and CVS directories, and all files ending with *.bak or ~.
> The include/exclude pattern applies to all the source directories. In fact, > the default behavior would just look for the src/main/resources directory, > and if it exists, call from with it once for the resources task.
> Assaf
> For example;
> > resources.from( _("src-test") )
> > will Buildr recurse through the child directories of src-test and > > include all of the resources by default?
> > On Jul 11, 6:37 am, Alexis <alexismi...@gmail.com> wrote: > > > Option 3 is exactly what I was looking for yesterday. > > > In my opinion, this is the most comprehensible solution.
> > > I like the way the resource directory is clearly identified with the > > > 'from' method. > > > Chained with include/exclude, it avoids ambiguity about the filter > > > root directory.
> > > > On 7/10/07, Alexis <alexismi...@gmail.com> wrote:
> > > > > Hey guys,
> > > > > for some reasons I'd like to keep my hbm files in a separate > > > > > directory. > > > > > So I need to add src/main/hbm to the list of resources.
> > > > > not really neat, but the filter instance hold by the 'resource' task > > > > > is bound to single directory (@source).
> > > > > I'd just like to ask if there is a better way.
> > > > Hopefully. This came up before, I had some ideas, and want to share it > > with > > > > you and see what you all think.
> > > > Option 1, we can use the include method to add another source > > directory, so > > > > you can do:
> > > > resources.include _("src/main/hbm")
> > > > That will copy the contents of the hbm directory into target/classes, > > and > > > > most times will do the right thing. But there is no way to copy a > > directory > > > > into target/classes, if you wanted to do something like > > > > resources.include_("src/images") it will copy the image files, not the > > > > images directory. > > > > You'd have to use the longer filter ... run for this.
> > > > Option 2, you need to copy files individually, so:
> > > > resources.include _("src/main/hbm/*")
> > > > Which unfortunately won't work some of the time. It will look for > > files in > > > > the hbm directory, but if the hbm directory doesn't already exist, it > > won't > > > > find any, and since hbm is not a target, it will not execute any task > > to > > > > create them. This will just be frustrating to use.
> > > > Option 3, add additional source directories using from, so:
> > > > resources.from _("src/main/hbm")
> > > > On the face of it, it looks similar to option 1, but there's a subtle > > > > difference in the way include/exclude are used. In option 1, > > include/exclude > > > > must point to the actual files (absolute paths) being included, > > excluded. > > > > Say I only want to copy jpg files (and skip png files). For option 1:
> > > > I'm leaning towards option 3 that will allow resources to copy files > > from > > > > more source directories, and retain the relative path include/exclude > > > > options.
> On Jul 11, 1:07 pm, "Assaf Arkin" <a...@labnotes.org> wrote: > > On 7/11/07, Caleb Powell <caleb.pow...@gmail.com> wrote:
> > > I was dealing with this problem as well, and I think option 3 is the > > > way to go. Just out of curiosity, if the include/exclude > > > methods are not invoked, will all of the resources from the dir be > > > copied by default?
> > I still have your e-mail, but I had to mentally work through all the > > combinations so it got pushed to after 1.2.
> > If you don't tell it which files to include, it defaults to "*", which > > processes all the files/directories in the source directory, and does so > > recursively. There's a default exclusion pattern, so it will always > exclude > > the .svn and CVS directories, and all files ending with *.bak or ~.
> > The include/exclude pattern applies to all the source directories. In > fact, > > the default behavior would just look for the src/main/resources > directory, > > and if it exists, call from with it once for the resources task.
> > Assaf
> > For example;
> > > resources.from( _("src-test") )
> > > will Buildr recurse through the child directories of src-test and > > > include all of the resources by default?
> > > On Jul 11, 6:37 am, Alexis <alexismi...@gmail.com> wrote: > > > > Option 3 is exactly what I was looking for yesterday. > > > > In my opinion, this is the most comprehensible solution.
> > > > I like the way the resource directory is clearly identified with the > > > > 'from' method. > > > > Chained with include/exclude, it avoids ambiguity about the filter > > > > root directory.
> > > > > On 7/10/07, Alexis <alexismi...@gmail.com> wrote:
> > > > > > Hey guys,
> > > > > > for some reasons I'd like to keep my hbm files in a separate > > > > > > directory. > > > > > > So I need to add src/main/hbm to the list of resources.
> > > > > > not really neat, but the filter instance hold by the 'resource' > task > > > > > > is bound to single directory (@source).
> > > > > > I'd just like to ask if there is a better way.
> > > > > Hopefully. This came up before, I had some ideas, and want to > share it > > > with > > > > > you and see what you all think.
> > > > > Option 1, we can use the include method to add another source > > > directory, so > > > > > you can do:
> > > > > resources.include _("src/main/hbm")
> > > > > That will copy the contents of the hbm directory into > target/classes, > > > and > > > > > most times will do the right thing. But there is no way to copy a > > > directory > > > > > into target/classes, if you wanted to do something like > > > > > resources.include_("src/images") it will copy the image files, not > the > > > > > images directory. > > > > > You'd have to use the longer filter ... run for this.
> > > > > Option 2, you need to copy files individually, so:
> > > > > resources.include _("src/main/hbm/*")
> > > > > Which unfortunately won't work some of the time. It will look for > > > files in > > > > > the hbm directory, but if the hbm directory doesn't already exist, > it > > > won't > > > > > find any, and since hbm is not a target, it will not execute any > task > > > to > > > > > create them. This will just be frustrating to use.
> > > > > Option 3, add additional source directories using from, so:
> > > > > resources.from _("src/main/hbm")
> > > > > On the face of it, it looks similar to option 1, but there's a > subtle > > > > > difference in the way include/exclude are used. In option 1, > > > include/exclude > > > > > must point to the actual files (absolute paths) being included, > > > excluded. > > > > > Say I only want to copy jpg files (and skip png files). For option > 1: