You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

manifestclasspath.html 4.4 KiB

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