summaryrefslogtreecommitdiffstats
path: root/docs/manual/tasks/importurl.html
blob: d302df5048423c5103f10ff2755b73f6f6819ff4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Ant-contrib Tasks: Importurl</title>
  </head>

  <body>
    <h1>Importurl</h1>

    <p>The Importurl task will download a file, and import it's contents into the
       current project.  The file can be in the form of a standard ant .xml project
       file, or a .jar/.zip file.
    </p>
    <p>In the case of an .xml file, the file is downloaded, and imported as
       is.  In this case, the file itself is the only thing downloaded (ie.
       no corresponding .properties files, or other build files are downloaded).
    </p>
    <p>In the case of a .jar/.zip file, the file is downloaded and then
       decompressed.  After decompression, the file 'build.xml' at the root
       level of the jar is imported. By importing a .jar/.zip file, one can package additional resources along with
       the build.xml file.  However, you must be careful how you refer to these resources.
       The build.xml file must follow the same rules as any other file imported with the
       &lt;import&gt; task, in that references relative to the build.xml file must be
       made with the property:
           ant.file.&lt;projectname&gt;
       where &lt;projectname&gt; is the name of the project being imported, as specified
       in the project tag.  Example:
    </p>
    
    <pre>    
    <code>
        &lt;project name="common"&gt;
            &lt;basedir property="ant.dir.common" file="${ant.file.common}" /&gt;
            &lt;property file="${ant.dir.common}/build.properties" /&gt;
        &lt;/project&gt;
    </code>
    </pre>    

    <p>
       This task should be compatible with older versions of ant, but has only been
       tested with Ant 1.6.x.  The underlying implementation is done using the
       <a href="http://jayasoft.org/ivy">Ivy</a> dependency resolver software,
       and thus, it needs available to the same classloader that loads this task.
    </p>
    <h2>Parameters</h2>
    <table border="1" cellpadding="2" cellspacing="0">
      <tr>
        <th>Attribute</th>
        <th>Description</th>
        <th>Required</th>
      </tr>
      <tr>
        <td valign="top">org</td>
        <td valign="top">The organization that publishes the script.</td>
        <td align="center" valign="top">Yes.</td>
      </tr>
      <tr>
        <td valign="top">module</td>
        <td valign="top">The name of the module which is to be fetched.</td>
        <td align="center" valign="top">Yes.</td>
      </tr>
      <tr>
        <td valign="top">ref</td>
        <td valign="top">The revision of the module to be fetched.</td>
        <td align="center" valign="top">No.  Defaults to "latest.integration".
           See the ivy details for more information on the possible wildcarding
           that can be used for this value.</td>
      </tr>
      <tr>
        <td valign="top">type</td>
        <td valign="top">The type of file to be downloaded</td>
        <td align="center" valign="top">No.  Defaults to 'jar'.  Can be
            any file extension.  However, unless the type is 'xml', the
            file is assumed to be a compressed file, expandable by ant's
            &lt;expand&gt; task (which is aliased to unjar, unzip).</td>
      </tr>
      <tr>
        <td valign="top">repositoryUrl</td>
        <td valign="top">The URL base of the repository to use.  This
        results in using Ivy's URLResolver to resolve the requested
        resource.</td>
        <td align="center" valign="top">No.  Defaults to the IvyRepResolver.</td>
      </tr>
      <tr>
        <td valign="top">repositoryDir</td>
        <td valign="top">The file base of the repository to use.  This
        results in using Ivy's FileSystemResolver to resolve the requested
        resource.</td>
        <td align="center" valign="top">No.  Defaults to the IvyRepResolver.</td>
      </tr>
      <tr>
        <td valign="top">artifactPattern</td>
        <td valign="top">The pattern used to find artifacts in the repository.</td>
        <td align="center" valign="top">No.  If repositoryUrl or repositoryDir
        are specified, this defaults to the standard repository pattern:
        "/[org]/[module]/[ext]s/[module]-[revision].[ext]".  Please see the
        ivy documentation for more information on the contents of this pattern.
        </td>
      </tr>
    </table>


    <h2>Example</h2>


    <pre>
    <code>
    &lt;antcontrib:importurl org="antcontrib"
                             module="common"
                             rev="3.2" /&gt;
    </code>
    </pre>
    
    <pre>
    <code>
    &lt;antcontrib:importurl org="antcontrib"
                             module="common"
                             rev="3.2" 
                             type="xml" /&gt;
    </code>
    </pre>

    <pre>
    <code>
    &lt;antcontrib:importurl repositoryUrl="http://www.antcontrib.org/ivyrep"
                             org="antcontrib"
                             module="common"
                             rev="3.2" 
                             type="xml" /&gt;
    </code>
    </pre>
    
    The following build.xml may be packaged into a .jar with it's corresponding
    build.properties file:
    
    <pre>
    <code>
    &lt;project name="common"&gt;
    &lt;basedir property="ant.dir.common" file="${ant.file.common}" /&gt;
    &lt;property file="${ant.dir.common}/build.properties" /&gt;
    &lt;/project&gt;
    </code>
    </pre>


    <hr>
    <p align="center">Copyright &copy; 2002-2006 Ant-Contrib Project. All
    rights Reserved.</p>

  </body>
</html>