1 | <!--
|
---|
2 | Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
3 | contributor license agreements. See the NOTICE file distributed with
|
---|
4 | this work for additional information regarding copyright ownership.
|
---|
5 | The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
6 | (the "License"); you may not use this file except in compliance with
|
---|
7 | the License. You may obtain a copy of the License at
|
---|
8 |
|
---|
9 | http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 |
|
---|
11 | Unless required by applicable law or agreed to in writing, software
|
---|
12 | distributed under the License is distributed on an "AS IS" BASIS,
|
---|
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
14 | See the License for the specific language governing permissions and
|
---|
15 | limitations under the License.
|
---|
16 | -->
|
---|
17 | <html>
|
---|
18 |
|
---|
19 | <head>
|
---|
20 | <meta http-equiv="Content-Language" content="en-us">
|
---|
21 | <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
---|
22 | <title>ManifestClassPath Task</title>
|
---|
23 | </head>
|
---|
24 |
|
---|
25 | <body>
|
---|
26 |
|
---|
27 | <h2><a name="manifestclasspath">Manifestclasspath</a></h2>
|
---|
28 |
|
---|
29 | <h3>Description</h3>
|
---|
30 | <p>Converts a <a href="../using.html#path">Path</a> into a property
|
---|
31 | whose value is appropriate for a <a href="manifest.html">Manifest</a>'s
|
---|
32 | <code>Class-Path</code> attribute.</p>
|
---|
33 |
|
---|
34 | <p>This task is often used to work around command line limitations on Windows
|
---|
35 | when using very long class paths when launching an application. The long class
|
---|
36 | path normally specified on the command line is replaced by a single (possibly
|
---|
37 | empty) jar file which an in-manifest Class-Path attribute whose value lists
|
---|
38 | all the jar and zip files the class path should contain. The files referenced
|
---|
39 | from this attribute must be found relatively to the jar file itself, usually
|
---|
40 | in the same directory. The Java VM automically uses all file entries listed
|
---|
41 | in the Class-Path attributes of a jar to locate/load classes. Note though that
|
---|
42 | it silently ignores entries for which it cannot find any corresponding file.</p>
|
---|
43 |
|
---|
44 | <p>Note that the property value created may be longer than a manifest's maximum
|
---|
45 | 72 characters per line, but will be properly wrapped as per the Jar
|
---|
46 | specification by the <code><manifest></code> element, where the
|
---|
47 | defined property is re-referenced.</p>
|
---|
48 |
|
---|
49 | <p><em>since Ant 1.7</em></p>
|
---|
50 |
|
---|
51 | <h3>Parameters</h3>
|
---|
52 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
53 | <tr>
|
---|
54 | <td valign="top"><b>Attribute</b></td>
|
---|
55 | <td valign="top"><b>Description</b></td>
|
---|
56 | <td align="center" valign="top"><b>Required</b></td>
|
---|
57 | </tr>
|
---|
58 | <tr>
|
---|
59 | <td valign="top">property</td>
|
---|
60 | <td valign="top">the name of the property to set. This property must
|
---|
61 | not already be set.</td>
|
---|
62 | <td valign="top" align="center">Yes</td>
|
---|
63 | </tr>
|
---|
64 | <tr>
|
---|
65 | <td valign="top">jarfile</td>
|
---|
66 | <td valign="top">
|
---|
67 | the filename for the Jar which will contain the manifest that will
|
---|
68 | use the property this task will set. This file need not exist yet,
|
---|
69 | but its parent directory must exist.
|
---|
70 | </td>
|
---|
71 | <td valign="top" align="center">Yes</td>
|
---|
72 | </tr>
|
---|
73 | <tr>
|
---|
74 | <td valign="top">maxParentLevels</td>
|
---|
75 | <td valign="top">
|
---|
76 | The maximum number of parent directories one is allowed to traverse
|
---|
77 | to navigate from the jar file to the path entry. Put differently, the
|
---|
78 | maximum number of .. which is allowed in the relative path from the
|
---|
79 | jar file to a given class path enty. Specify 0 to enforce a path
|
---|
80 | entry to be in the same directory (or one of its sub-directories)
|
---|
81 | as the jar file itself. Defaults to 2 levels.</td>
|
---|
82 | <td valign="top" align="center">No</td>
|
---|
83 | </tr>
|
---|
84 | </table>
|
---|
85 |
|
---|
86 | <h3>Parameters specified as nested elements</h3>
|
---|
87 | <h4>classpath</h4>
|
---|
88 | <p>A <a href="../using#path.html">Path-like</a> element, which can be
|
---|
89 | defined in-place, or refer to a path defined elsewhere using the
|
---|
90 | <code><classpath refid="<em>pathid</em>" /></code> syntax.
|
---|
91 | This classpath must not be empty, and is required.</p>
|
---|
92 |
|
---|
93 | <h3>Examples</h3>
|
---|
94 | <div id="example1">
|
---|
95 | <blockquote><pre>
|
---|
96 | <manifestclasspath property="jar.classpath"
|
---|
97 | jarfile="build/acme.jar">
|
---|
98 | <classpath refid="classpath" />
|
---|
99 | </manifestclasspath>
|
---|
100 | </pre></blockquote>
|
---|
101 | <p>Assuming a path of id "classpath" was already defined, convert this
|
---|
102 | path relatively to the build/ directory that will contain acme.jar, which
|
---|
103 | can later be created with <code><jar></code> with a nested
|
---|
104 | <code><manifest></code> element that lists an
|
---|
105 | <code><attribute name="Class-Path" value="${jar.classpath}" /></code>.
|
---|
106 | </p>
|
---|
107 | </div>
|
---|
108 |
|
---|
109 |
|
---|
110 |
|
---|
111 | </body>
|
---|
112 | </html>
|
---|