开发者

Ant scriptmapper doesn't work as advertised?

开发者 https://www.devze.com 2022-12-29 06:47 出处:网络
Based on http://ant.apache.org/manual/Types/mapper.html Here\'s my target: <target name=\"ms.copy-example\">

Based on http://ant.apache.org/manual/Types/mapper.html

Here's my target:

 <target name="ms.copy-example">
  <copy todir="${ms.custom}">
   <fileset dir="${ms.example}">
    <include name="build.xml" />
   </fileset>
   <scriptmapper language="javascript">
     self.addMappedName("dir1/"+source);
     self.addMappedName("dir2/"+source);
     self.addMappedName("dir3/"+source);
   </scriptmapper>
  </copy>
 </target>

I'm trying to copy one file to three places. I don't have to use a 'scriptmapper' to do this, but I didn't see any other way to do it. What's happening, 开发者_Python百科though, is that it's only copying the file into the first directory in the list (dir1) and not the other two (dir2, dir3).

Anyone suggestions?


The scriptmapper is working, but by default, the copy task only copies to one (i.e. the first mapped) target. To get your example to work, add enablemultiplemappings="true" or similar to the copy:

<copy todir="${ms.custom}" enablemultiplemappings="true">

From the docs for copy task option enablemultiplemappings:

If true the task will process to all the mappings for a given source path. If false the task will only process the first file or directory. This attribute is only relevant if there is a mapper subelement. (since Ant 1.6.)

0

精彩评论

暂无评论...
验证码 换一张
取 消