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 3.7 KiB

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