ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <>
Subject Re: AW: AW: Prepend licence information to every source file
Date Fri, 17 Sep 2004 13:42:15 GMT
There is no in-place prepend task (I think), but one can do this
  1) getting a fileset that contain the files the need the license to
     be added
  2) iterate over the the files added the license by
         a) adding the licence to a file making a new file
         b) move that new file to overwrite the original file

one can use the ant-contrib <for> task to do the iteration:

<project default="addlicense" xmlns:ac="antlib:net.sf.antcontrib">
  <target name="addlicense">
    <ac:for param="file">
      <fileset id="missing" dir="src" includes="**/*.java">
          <contains text="you may not use this file except in compliance 
with the License"/>
        <copy file="@{file}" tofile="@{file}.withlicense">
            <concatfilter prepend="license-java.txt"/>
        <move file="@{file}.withlicense" tofile="@{file}"/>

Kannan V wrote:

>Hi Jan,
>  Thanks for the help. So that means that if my source files doesn't have header info,
>I have to copy them to a temp location for adding the licence text. I was trying to avoid
>copying to temp location part so that I can run the task on my src folder directly.
>thannks and regards,
>-- Kannan.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message