Browse Source

Add an example how to store a program-version info in the manifest. Make the code more readable.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@492552 13f79535-47bb-0310-9956-ffa450edef68
master
Jan Materne 18 years ago
parent
commit
5be0ff33b8
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      docs/manual/CoreTasks/jar.html

+ 12
- 0
docs/manual/CoreTasks/jar.html View File

@@ -324,10 +324,14 @@ empty or only contain files inside the META-INF directory.</p>
If a JAR file has more that one implementation of the service, a number of If a JAR file has more that one implementation of the service, a number of
nested &lt;provider&gt; elements may be used. nested &lt;provider&gt; elements may be used.
</p> </p>
<h3>Examples</h3> <h3>Examples</h3>

<pre> &lt;jar destfile=&quot;${dist}/lib/app.jar&quot; basedir=&quot;${build}/classes&quot;/&gt;</pre> <pre> &lt;jar destfile=&quot;${dist}/lib/app.jar&quot; basedir=&quot;${build}/classes&quot;/&gt;</pre>
<p>jars all files in the <code>${build}/classes</code> directory into a file <p>jars all files in the <code>${build}/classes</code> directory into a file
called <code>app.jar</code> in the <code>${dist}/lib</code> directory.</p> called <code>app.jar</code> in the <code>${dist}/lib</code> directory.</p>

<pre> &lt;jar destfile=&quot;${dist}/lib/app.jar&quot; <pre> &lt;jar destfile=&quot;${dist}/lib/app.jar&quot;
basedir=&quot;${build}/classes&quot; basedir=&quot;${build}/classes&quot;
excludes=&quot;**/Test.class&quot; excludes=&quot;**/Test.class&quot;
@@ -335,6 +339,7 @@ called <code>app.jar</code> in the <code>${dist}/lib</code> directory.</p>
<p>jars all files in the <code>${build}/classes</code> directory into a file <p>jars all files in the <code>${build}/classes</code> directory into a file
called <code>app.jar</code> in the <code>${dist}/lib</code> directory. Files called <code>app.jar</code> in the <code>${dist}/lib</code> directory. Files
with the name <code>Test.class</code> are excluded.</p> with the name <code>Test.class</code> are excluded.</p>

<pre> &lt;jar destfile=&quot;${dist}/lib/app.jar&quot; <pre> &lt;jar destfile=&quot;${dist}/lib/app.jar&quot;
basedir=&quot;${build}/classes&quot; basedir=&quot;${build}/classes&quot;
includes=&quot;mypackage/test/**&quot; includes=&quot;mypackage/test/**&quot;
@@ -344,6 +349,7 @@ with the name <code>Test.class</code> are excluded.</p>
called <code>app.jar</code> in the <code>${dist}/lib</code> directory. Only called <code>app.jar</code> in the <code>${dist}/lib</code> directory. Only
files under the directory <code>mypackage/test</code> are used, and files with files under the directory <code>mypackage/test</code> are used, and files with
the name <code>Test.class</code> are excluded.</p> the name <code>Test.class</code> are excluded.</p>

<pre> &lt;jar destfile=&quot;${dist}/lib/app.jar&quot;&gt; <pre> &lt;jar destfile=&quot;${dist}/lib/app.jar&quot;&gt;
&lt;fileset dir=&quot;${build}/classes&quot; &lt;fileset dir=&quot;${build}/classes&quot;
excludes=&quot;**/Test.class&quot; excludes=&quot;**/Test.class&quot;
@@ -363,6 +369,7 @@ by Java).</p>
&lt;include name=&quot;build&quot;/&gt; &lt;include name=&quot;build&quot;/&gt;
&lt;manifest&gt; &lt;manifest&gt;
&lt;attribute name=&quot;Built-By&quot; value=&quot;${user.name}&quot;/&gt; &lt;attribute name=&quot;Built-By&quot; value=&quot;${user.name}&quot;/&gt;
&lt;attribute name=&quot;Program-Version&quot; value=&quot;1.0.0beta2&quot;/&gt;
&lt;section name=&quot;common/class1.class&quot;&gt; &lt;section name=&quot;common/class1.class&quot;&gt;
&lt;attribute name=&quot;Sealed&quot; value=&quot;false&quot;/&gt; &lt;attribute name=&quot;Sealed&quot; value=&quot;false&quot;/&gt;
&lt;/section&gt; &lt;/section&gt;
@@ -375,6 +382,7 @@ produced by the above would look like this:
</p> </p>
<pre><code>Manifest-Version: 1.0 <pre><code>Manifest-Version: 1.0
Built-By: conor Built-By: conor
Program-Version: 1.0.0beta2
Created-By: Apache Ant 1.6.5 Created-By: Apache Ant 1.6.5


Name: common/MyClass.class Name: common/MyClass.class
@@ -391,6 +399,7 @@ Sealed: false</code></pre>
provider="org.acme.PinkyLanguage"/&gt; provider="org.acme.PinkyLanguage"/&gt;
&lt;/jar&gt; &lt;/jar&gt;
</pre></blockquote> </pre></blockquote>

<p> <p>
The following shows how to create a jar file specifing a service The following shows how to create a jar file specifing a service
with two implementations of the JDK6 scripting interface: with two implementations of the JDK6 scripting interface:
@@ -404,5 +413,8 @@ Sealed: false</code></pre>
&lt;/service&gt; &lt;/service&gt;
&lt;/jar&gt; &lt;/jar&gt;
</pre></blockquote> </pre></blockquote>



</body> </body>
</html> </html>

Loading…
Cancel
Save