source: release-kits/lirk3/resources/gs3-release-maker/apache-ant-1.6.5/docs/manual/OptionalTasks/jlink.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 5.6 KB
Line 
1<html>
2<head>
3<title>JLink Task</title>
4<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
5</head>
6<body>
7
8<h2><a name="jlink">Jlink</a></h2>
9<h3><i>Deprecated</i></h3>
10<p><i>This task has been deprecated. Use the zipfileset and zipgroupfileset attributes of the <a href="../CoreTasks/jar.html">Jar task</a> or <a href="../CoreTasks/zip.html">Zip task</a> instead.</i></p>
11
12<h3><b>Description:</b></h3>
13<p>Links entries from sub-builds and libraries.</p>
14
15<p>The jlink task can be used to build jar and zip files, similar to
16the <i>jar</i> task.
17However, jlink provides options for controlling the way entries from
18input files
19are added to the output file. Specifically, capabilities for merging
20entries from
21multiple zip or jar files is available.</p>
22
23<p>If a mergefile is specified directly (eg. at the top level of a
24<i>mergefiles</i>
25pathelement) <i>and</i> the mergefile ends in &quot;.zip&quot; or
26&quot;.jar&quot;,
27entries in the mergefile will be merged into the outfile. A file with
28any other extension
29will be added to the output file, even if it is specified in the
30mergefiles element.
31Directories specified in either the mergefiles or addfiles element
32are added to the
33output file as you would expect: all files in subdirectories are
34recursively added to
35the output file with appropriate prefixes in the output file
36(without merging).
37</p>
38
39<p>
40In the case where duplicate entries and/or files are found among the
41files to be merged or
42added, jlink merges or adds the first entry and ignores all subsequent entries.
43</p>
44
45<p>
46jlink ignores META-INF directories in mergefiles. Users should supply their
47own manifest information for the output file.
48</p>
49
50<p>It is possible to refine the set of files that are being jlinked.
51This can be
52done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>,
53<i>excludesfile</i>,
54and <i>defaultexcludes</i> attributes on the <i>addfiles</i> and
55<i>mergefiles</i>
56nested elements. With the <i>includes</i> or <i>includesfile</i>
57attribute you specify the files you want to have included by using patterns.
58The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
59the files you want to have excluded. This is also done with patterns. And
60finally with the <i>defaultexcludes</i> attribute, you can specify whether you
61want to use default exclusions or not. See the section on <a
62href="../dirtasks.html#directorybasedtasks">directory based tasks</a>, on how the
63inclusion/exclusion of files works, and how to write patterns. The patterns are
64relative to the <i>base</i> directory.</p>
65
66
67
68<h3>Parameters:</h3>
69<table border="1" cellpadding="2" cellspacing="0">
70 <tr>
71 <td valign="top"><b>Attribute</b></td>
72 <td valign="top"><b>Description</b></td>
73 <td align="center" valign="top"><b>Required</b></td>
74 </tr>
75 <tr>
76 <td valign="top">outfile</td>
77 <td valign="top">the path of the output file.</td>
78 <td valign="top" align="center">Yes</td>
79 </tr>
80 <tr>
81 <td valign="top">compress</td>
82 <td valign="top">whether or not the output should be compressed.
83<i>true</i>,
84 <i>yes</i>, or <i>on</i> result in compressed output.
85 If omitted, output will be uncompressed (inflated).</td>
86 <td valign="top" align="center">No</td>
87 </tr>
88 <tr>
89 <td valign="top">mergefiles</td>
90 <td valign="top">files to be merged into the output, if possible.</td>
91 <td valign="middle" align="center" rowspan="2">At least one of
92mergefiles or addfiles</td>
93 </tr>
94 <tr>
95 <td valign="top">addfiles</td>
96 <td valign="top">files to be added to the output.</td>
97 </tr>
98</table>
99
100<h3>Examples</h3>
101
102<p>The following will merge the entries in mergefoo.jar and mergebar.jar
103into out.jar.
104mac.jar and pc.jar will be added as single entries to out.jar.</p>
105<pre>
106&lt;jlink compress=&quot;false&quot; outfile=&quot;out.jar&quot;&gt;
107 &lt;mergefiles&gt;
108 &lt;pathelement path=&quot;${build.dir}/mergefoo.jar&quot;/&gt;
109 &lt;pathelement path=&quot;${build.dir}/mergebar.jar&quot;/&gt;
110 &lt;/mergefiles&gt;
111 &lt;addfiles&gt;
112 &lt;pathelement path=&quot;${build.dir}/mac.jar&quot;/&gt;
113 &lt;pathelement path=&quot;${build.dir}/pc.zip&quot;/&gt;
114 &lt;/addfiles&gt;
115&lt;/jlink&gt;
116</pre>
117
118<p><b>Non-deprecated alternative to the above:</b></p>
119<pre>
120&lt;jar compress=&quot;false&quot; destfile=&quot;out.jar&quot;&gt;
121 &lt;zipgroupfileset dir=&quot;${build.dir}&quot;&gt;
122 &lt;include name=&quot;mergefoo.jar&quot;/&gt;
123 &lt;include name=&quot;mergebar.jar&quot;/&gt;
124 &lt;/zipgroupfileset&gt;
125 &lt;fileset dir=&quot;${build.dir}&quot;&gt;
126 &lt;include name=&quot;mac.jar&quot;/&gt;
127 &lt;include name=&quot;pc.jar&quot;/&gt;
128 &lt;/fileset&gt;
129&lt;/jar&gt;
130</pre>
131
132<p>Suppose the file foo.jar contains two entries: bar.class and
133barnone/myClass.zip.
134Suppose the path for file foo.jar is build/tempbuild/foo.jar. The
135following example
136will provide the entry tempbuild/foo.jar in the out.jar.</p>
137<pre>
138&lt;jlink compress=&quot;false&quot; outfile=&quot;out.jar&quot;&gt;
139 &lt;mergefiles&gt;
140 &lt;pathelement path=&quot;build/tempbuild&quot;/&gt;
141 &lt;/mergefiles&gt;
142&lt;/jlink&gt;
143</pre>
144
145<p>However, the next example would result in two top-level entries in out.jar,
146namely bar.class and barnone/myClass.zip</p>
147<pre>
148&lt;jlink compress=&quot;false&quot; outfile=&quot;out.jar&quot;&gt;
149 &lt;mergefiles&gt;
150 &lt;pathelement path=&quot;build/tempbuild/foo.jar&quot;/&gt;
151 &lt;/mergefiles&gt;
152&lt;/jlink&gt;
153</pre>
154
155<hr>
156<p align="center">Copyright &copy; 2000-2002,2004 The Apache Software Foundation. All rights
157Reserved.</p>
158</body>
159
160</html>
Note: See TracBrowser for help on using the repository browser.