I have a source d开发者_运维问答irectory with a bunch of plugins. Each plugin has its own lib
directory. I want the contents of each of those lib
directories to be merged into a single lib
directory within my build. In theory you'd do something like this:
<copy todir="build/web/lib">
<fileset dir="web/plugins/*/lib/" includes="**/*" />
</copy>
However, Ant chokes when the dir attribute includes a wildcard. Is ant-contrib the only alternative, or can you make this work with vanilla ant?
Choke message is build.xml:28: [...]/web/plugins/*/lib does not exist.
The dir=
attribute of a fileset doesn't take a wildcard - hence the error you see. You need to specify a single directory, in this case web/plugins
, and use a slightly different wildcard for the includes:
<copy todir="build/web/lib">
<fileset dir="web/plugins" includes="*/lib/**/*" />
</copy>
If you need to alter the paths as you copy, you can use a mapper, for example the flattenmapper
will give you file names with all leading directory information stripped off.
精彩评论