| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>Ant-contrib Tasks: Importurl</title> |
| 5 | </head> |
| 6 | |
| 7 | <body> |
| 8 | <h1>Importurl</h1> |
| 9 | |
| 10 | <p>The Importurl task will download a file, and import it's contents into the |
| 11 | current project. The file can be in the form of a standard ant .xml project |
| 12 | file, or a .jar/.zip file. |
| 13 | </p> |
| 14 | <p>In the case of an .xml file, the file is downloaded, and imported as |
| 15 | is. In this case, the file itself is the only thing downloaded (ie. |
| 16 | no corresponding .properties files, or other build files are downloaded). |
| 17 | </p> |
| 18 | <p>In the case of a .jar/.zip file, the file is downloaded and then |
| 19 | decompressed. After decompression, the file 'build.xml' at the root |
| 20 | level of the jar is imported (the name of the imported file can be |
| 21 | overriden with the 'resource' attribute). By importing a .jar/.zip file, |
| 22 | one can package additional resources along with the build.xml file. However, |
| 23 | you must be careful how you refer to these resources. The build.xml file must |
| 24 | follow the same rules as any other file imported with the |
| 25 | <import> task, in that references relative to the build.xml file must be |
| 26 | made with the property: |
| 27 | ant.file.<projectname> |
| 28 | where <projectname> is the name of the project being imported, as specified |
| 29 | in the project tag. Example: |
| 30 | </p> |
| 31 | |
| 32 | <pre> |
| 33 | <code> |
| 34 | <project name="common"> |
| 35 | <dirname property="ant.dir.common" file="${ant.file.common}" /> |
| 36 | <property file="${ant.dir.common}/build.properties" /> |
| 37 | </project> |
| 38 | </code> |
| 39 | </pre> |
| 40 | |
| 41 | <p> |
| 42 | This task should be compatible with older versions of ant, but has only been |
| 43 | tested with Ant 1.6.x. The underlying implementation is done using the |
| 44 | <a href="http://jayasoft.org/ivy">Ivy</a> dependency resolver software, |
| 45 | and thus, it needs available to the same classloader that loads this task. |
| 46 | </p> |
| 47 | <h2>Parameters</h2> |
| 48 | <table border="1" cellpadding="2" cellspacing="0"> |
| 49 | <tr> |
| 50 | <th>Attribute</th> |
| 51 | <th>Description</th> |
| 52 | <th>Required</th> |
| 53 | </tr> |
| 54 | <tr> |
| 55 | <td valign="top">org</td> |
| 56 | <td valign="top">The organization that publishes the script.</td> |
| 57 | <td align="center" valign="top">Yes.</td> |
| 58 | </tr> |
| 59 | <tr> |
| 60 | <td valign="top">module</td> |
| 61 | <td valign="top">The name of the module which is to be fetched.</td> |
| 62 | <td align="center" valign="top">Yes.</td> |
| 63 | </tr> |
| 64 | <tr> |
| 65 | <td valign="top">rev</td> |
| 66 | <td valign="top">The revision of the module to be fetched.</td> |
| 67 | <td align="center" valign="top">No. Defaults to "latest.integration". |
| 68 | See the ivy details for more information on the possible wildcarding |
| 69 | that can be used for this value.</td> |
| 70 | </tr> |
| 71 | <tr> |
| 72 | <td valign="top">type</td> |
| 73 | <td valign="top">The type of file to be downloaded</td> |
| 74 | <td align="center" valign="top">No. Defaults to 'jar'. Can be |
| 75 | any file extension. However, unless the type is 'xml', the |
| 76 | file is assumed to be a compressed file, expandable by ant's |
| 77 | <expand> task (which is aliased to unjar, unzip).</td> |
| 78 | </tr> |
| 79 | <tr> |
| 80 | <td valign="top">ivyConfUrl</td> |
| 81 | <td valign="top">The URL of an ivy configuration file to use. We |
| 82 | will use the default resolver in this file to find the requested |
| 83 | resource.</td> |
| 84 | <td align="center" valign="top">No. Defaults to the IvyRepResolver.</td> |
| 85 | </tr> |
| 86 | <tr> |
| 87 | <td valign="top">ivyConfFile</td> |
| 88 | <td valign="top">The path of an ivy configuration file to use. We |
| 89 | will use the default resolver in this file to find the requested |
| 90 | resource.</td> |
| 91 | <td align="center" valign="top">No. Defaults to the IvyRepResolver.</td> |
| 92 | </tr> |
| 93 | <tr> |
| 94 | <td valign="top">repositoryUrl</td> |
| 95 | <td valign="top">The URL base of the repository to use. This |
| 96 | results in using Ivy's URLResolver to resolve the requested |
| 97 | resource.</td> |
| 98 | <td align="center" valign="top">No. Defaults to the IvyRepResolver.</td> |
| 99 | </tr> |
| 100 | <tr> |
| 101 | <td valign="top">repositoryDir</td> |
| 102 | <td valign="top">The file base of the repository to use. This |
| 103 | results in using Ivy's FileSystemResolver to resolve the requested |
| 104 | resource.</td> |
| 105 | <td align="center" valign="top">No. Defaults to the IvyRepResolver.</td> |
| 106 | </tr> |
| 107 | <tr> |
| 108 | <td valign="top">artifactPattern</td> |
| 109 | <td valign="top">The pattern used to find artifacts in the repository.</td> |
| 110 | <td align="center" valign="top">No. If repositoryUrl or repositoryDir |
| 111 | are specified, this defaults to the standard repository pattern: |
| 112 | "/[org]/[module]/[ext]s/[module]-[revision].[ext]". Please see the |
| 113 | ivy documentation for more information on the contents of this pattern. |
| 114 | </td> |
| 115 | </tr> |
| 116 | <tr> |
| 117 | <td valign="top">ivyPattern</td> |
| 118 | <td valign="top">The pattern used to find ivy file for the artifact in the repository.</td> |
| 119 | <td align="center" valign="top">No. If repositoryUrl or repositoryDir |
| 120 | are specified, this defaults to the standard repository pattern: |
| 121 | "/[org]/[module]/ivy-[revision].xml". Please see the |
| 122 | ivy documentation for more information on the contents of this pattern. |
| 123 | </td> |
| 124 | </tr> |
| 125 | <tr> |
| 126 | <td valign="top">resource</td> |
| 127 | <td valign="top">The name of the resource within a compressed file to import.</td> |
| 128 | <td align="center" valign="top">No. Defaults to "build.xml". |
| 129 | </td> |
| 130 | </tr> |
| 131 | </table> |
| 132 | |
| 133 | |
| 134 | <h2>Example</h2> |
| 135 | |
| 136 | |
| 137 | <pre> |
| 138 | <code> |
| 139 | <project name="build" basedir="." default="build" xmlns:ac="antlib:net.sf.antcontrib"> |
| 140 | <ac:antcontrib:importurl org="antcontrib" |
| 141 | module="common" |
| 142 | rev="3.2" /> |
| 143 | </project> |
| 144 | </code> |
| 145 | </pre> |
| 146 | |
| 147 | would look for the file "antcontrib/common/jars/common-3.2.jar" in the IvyRep |
| 148 | repository. |
| 149 | |
| 150 | <pre> |
| 151 | <code> |
| 152 | <ac:antcontrib:importurl org="antcontrib" |
| 153 | module="common" |
| 154 | rev="3.2" |
| 155 | type="xml" /> |
| 156 | </code> |
| 157 | </pre> |
| 158 | |
| 159 | would look for the file "antcontrib/common/jars/common-3.2.xml" in the IvyRep |
| 160 | repository. |
| 161 | |
| 162 | <pre> |
| 163 | <code> |
| 164 | <ac:antcontrib:importurl repositoryUrl="http://www.antcontrib.org/ivyrep" |
| 165 | org="antcontrib" |
| 166 | module="common" |
| 167 | rev="3.2" /> |
| 168 | </code> |
| 169 | </pre> |
| 170 | |
| 171 | would look for the located at |
| 172 | "http://www.antcontrib.org/ivyrep/antcontrib/common/jars/common-3.2.jar" |
| 173 | |
| 174 | <pre> |
| 175 | <code> |
| 176 | <ac:antcontrib:importurl ivyConfUrl="http://ivyrep.myorg.com/ivyconf.xml" |
| 177 | org="antcontrib" |
| 178 | module="common" |
| 179 | rev="3.2" /> |
| 180 | </code> |
| 181 | </pre> |
| 182 | |
| 183 | would configure ivy using the ivy configuration file at the given ivyConfUrl. |
| 184 | <p> |
| 185 | The following build.xml may be packaged into a .jar with it's corresponding |
| 186 | build.properties file: |
| 187 | </p> |
| 188 | |
| 189 | <pre> |
| 190 | <code> |
| 191 | <project name="common"> |
| 192 | <basedir property="ant.dir.common" file="${ant.file.common}" /> |
| 193 | <property file="${ant.dir.common}/build.properties" /> |
| 194 | </project> |
| 195 | </code> |
| 196 | </pre> |
| 197 | |
| 198 | |
| 199 | <hr> |
| 200 | <p align="center">Copyright © 2002-2006 Ant-Contrib Project. All |
| 201 | rights Reserved.</p> |
| 202 | |
| 203 | </body> |
| 204 | </html> |