[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Java dependency handling on a jpackage 1.5 rpm system



Same document with some more examples and a few fixes.

Regards,

-- 
Nicolas Mailhot
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>JPackage java infrastructure design and packaging policy</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.0" /><meta name="description" content="&#10;This document describes the packaging policy followed by the JPackage cross-distribution rpm java packaging project.&#10;      " /></head><body><div class="book" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="id2619227"></a>JPackage java infrastructure design and packaging policy</h1></div><div><div class="author"><h3 class="author"><span class="firstname">Nicolas</span> <span class="surname">Mailhot</span></h3><div class="affiliation"><span class="orgname">JPackage Project<br /></span></div></div></div><div><div class="abstract"><p class="title"><b>Abstract</b></p><p>
This document describes the packaging policy followed by the <a href="http://www.jpackage.org/"; target="_top">JPackage</a> cross-distribution rpm java packaging project.
      </p></div></div></div><div></div><hr /></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2892436">Why ?</a></dt><dt>1. <a href="#id2879555">General rules</a></dt><dd><dl><dt><a href="#id2879562">Be modular</a></dt><dt><a href="#id2879580">Be vendor and implementation agnostic</a></dt><dt><a href="#id2879609">Be distribution agnostic</a></dt></dl></dd><dt>2. <a href="#id2830629">Naming</a></dt><dd><dl><dt><a href="#id2830636">Package naming</a></dt><dt><a href="#id2830671">Jar file naming</a></dt></dl></dd><dt>3. <a href="#id2829187">Directory structure</a></dt><dd><dl><dt><a href="#id2829203">%{_javadir}</a></dt><dd><dl><dt><a href="#id2829218">/usr/share/java</a></dt><dt><a href="#id2829276">/usr/share/java-ext</a></dt><dt><a href="#id2829326">/usr/share/java-x.y.z</a></dt><dt><a href="#id2829625">/usr/share/java-utils</a></dt></dl></dd><dt><a href="#id2829662">%{_jnidir}:
 /usr/lib/java</a></dt><dt><a href="#id2829746">%{_jvmdir}</a></dt><dd><dl><dt><a href="#id2829760">/usr/lib/jvm</a></dt><dt><a href="#id2829800">/usr/lib/jvm-exports</a></dt></dl></dd><dt><a href="#id2829887">%{_sysconfdir}/java:
 /etc/java</a></dt><dt><a href="#id2829933">%{_javadocdir}</a></dt></dl></dd><dt>4. <a href="#id2829956">Scripts and actual run-time classpath resolution</a></dt><dd><dl><dt><a href="#id2830846">General resolution rules</a></dt><dt><a href="#id2831067">find-jar</a></dt><dt><a href="#id2831115">build-classpath</a></dt><dt><a href="#id2831247">build-jar-repository</a></dt><dt><a href="#id2831406">rebuild-jar-repository</a></dt></dl></dd></dl></div><div class="list-of-examples"><p><b>List of Examples</b></p><dl><dt>2.1. <a href="#id2828928">Single jar complete naming</a></dt><dt>2.2. <a href="#id2829054">Bunch of jars naming</a></dt><dt>3.1. <a href="#id2829490">Java standard version-specific repositories usage</a></dt><dt>4.1. <a href="#id2831160">build-classpath output</a></dt><dt>4.2. <a href="#id2831227">Constructing a classpath with mandatory and optional parts</a></dt><dt>4.3. <a href="#id2831344">build-jar-repository results</a></dt><dt>4.4. <a href="#id2831465">rebuild-jar-repository results</a></dt></dl></div><div class="preface" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id2892436"></a>Why ?</h2></div></div><div></div></div><p>
Clean Java packaging has historically been a daunting task. Lack of any standard addressing the physical location of files on the system combined with the common use of licensing terms that only allow free redistribution of key components as a part of a greater ensemble has let to the systematic release of self-sufficient applications with build-in copies of external components.
    </p><p>
As a consequence applications are only tested with the versions of the components they bundle, a complete Java system suffers from endless duplication of the same modules, and integrating multiple parts can be a nightmare since they are bound to depend on the same elements - only with different and subtly incompatible versions<sup>[<a id="id2892452" href="#ftn.id2892452">1</a>]</sup>. Any security or compatibility<sup>[<a id="id2892803" href="#ftn.id2892803">2</a>]</sup> upgrade must be performed for each of those duplicated elements.
    </p><p>
This problem is compounded by the current practice of folding extensions proper in the JVM itself after a while ; an element that could safely be embedded in a application will suddenly conflict with a JVM part and cause subtle failures.
    </p><p>
 It is not surprising then that complex Java systems tend to fossilize very quickly, with the cost of maintaining dependencies current growing too high so fast people basically give up on it.
    </p><p>
This situation is incompatible with your typical fast-evolving Linux platform. To attain its aim of user- and administrator-friendly rpm packaging of Java applications the JPackage Project had to evolve its own system infrastructure and strict packaging rules.
    </p><div class="footnotes"><br /><hr width="100" align="left" /><div class="footnote"><p><sup>[<a id="ftn.id2892452" href="#id2892452">1</a>] </sup>
Different requirements, different bugs.
	</p></div><div class="footnote"><p><sup>[<a id="ftn.id2892803" href="#id2892803">2</a>] </sup>
For example when the system kernel or C core changes Java assumptions.
        </p></div></div></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id2879555"></a>Chapter 1. General rules</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2879562">Be modular</a></dt><dt><a href="#id2879580">Be vendor and implementation agnostic</a></dt><dt><a href="#id2879609">Be distribution agnostic</a></dt></dl></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2879562"></a>Be modular</h2></div></div><div></div></div><p>
Whenever possible a module shall be broken out in its constituting elements. A given element will have a single name and location on the system. Only a single version of this element shall be installed. Applications sharing the same dependencies shall depend on external packages, not build-in versions.
      </p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2879580"></a>Be vendor and implementation agnostic</h2></div></div><div></div></div><p>
The user shall be able to choose between the different available implementations of the same element, especially when their licensing terms are not equivalent or their level of completeness unequal. Whenever possible it should be possible to install them in parallel, with the user able to select each of them specifically or let the system choose the best one<sup>[<a id="id2879597" href="#ftn.id2879597">3</a>]</sup>.
      </p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2879609"></a>Be distribution agnostic</h2></div></div><div></div></div><p>
Packages should work on most major rpm-based distributions. This means following standards like the <a href="http://www.linuxbase.org/"; target="_top">Linux Standard Base</a>, the <a href="http://www.pathname.com/fhs/"; target="_top">Filesystem Hierarchy Standard</a>, or <a href="http://www.freedesktop.org/"; target="_top">freedesktop.org</a> specifications.
      </p><p>
Above all usage of distribution-specific facilities<sup>[<a id="id2830589" href="#ftn.id2830589">4</a>]</sup> is <span class="emphasis"><em>forbidden</em></span>.
      </p><p>
Note this is a pragmatic reading of the standards. Facilities not specified but commonly found are readily used by the project<sup>[<a id="id2830614" href="#ftn.id2830614">5</a>]</sup> and distribution-specific adaptations are tolerated provided they do not interfere with common usage or a generic version is also available.
      </p></div><div class="footnotes"><br /><hr width="100" align="left" /><div class="footnote"><p><sup>[<a id="ftn.id2879597" href="#id2879597">3</a>] </sup>
Based on licensing terms, known completeness, relative bugginess, market penetration and so on.
          </p></div><div class="footnote"><p><sup>[<a id="ftn.id2830589" href="#id2830589">4</a>] </sup>
Like Mandrake <tt class="function">gprintf</tt> function.
          </p></div><div class="footnote"><p><sup>[<a id="ftn.id2830614" href="#id2830614">5</a>] </sup>
For example rpm 4 extensions, Debian's update-alternative system...
          </p></div></div></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id2830629"></a>Chapter 2. Naming</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2830636">Package naming</a></dt><dt><a href="#id2830671">Jar file naming</a></dt></dl></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2830636"></a>Package naming</h2></div></div><div></div></div><p>
Packages shall be named after the common name of their origin project in small caps. When a package provides an extension that was folded at some point in the Java standard, the <span class="emphasis"><em>-ext</em></span> (as in external) suffix shall be appended to distinguish between the package name and the extension name. Both the JVMs including this extension and the standalone extension package shall then have the original name as a virtual Provides.
      </p><p>
JVM packages shall be named <span class="emphasis"><em>java-standard_version-vendor</em></span>. Original on-site
names are not followed since practice varies wildly from vendor to vendor and version to version.
      </p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2830671"></a>Jar file naming</h2></div></div><div></div></div><div class="orderedlist"><ol type="1"><li><p>
If a package provides a single jar it shall have the same name as the package itself, with appended product version.
          </p><div class="informalexample"><pre class="screen"><tt class="filename">jaf-1.0.2.jar</tt></pre></div></li><li><p>
A non-versioned symbolic link pointing on the original file shall also be provided.
          </p><div class="informalexample"><pre class="screen"><tt class="filename">jaf-1.0.2.jar</tt>
<tt class="filename">jaf.jar</tt> â?? <tt class="filename">jaf-1.0.2.jar</tt></pre></div></li><li><p>
If the project name and the commonly used jar name differ a symbolic link with the usual name shall also be provided.
          </p><div class="example"><a id="id2828928"></a><p class="title"><b>Example 2.1. Single jar complete naming</b></p><pre class="screen"><tt class="filename">jaf-1.0.2.jar</tt>
<tt class="filename">jaf.jar</tt> â?? <tt class="filename">jaf-1.0.2.jar</tt>
<tt class="filename">activation.jar</tt> â?? <tt class="filename">jaf-1.0.2.jar</tt></pre></div></li><li><p>
If the package provides several jars their usual names will be used.
          </p><div class="informalexample"><pre class="screen"><tt class="filename">ant-1.5.3.jar</tt>
<tt class="filename">ant.jar</tt> â?? <tt class="filename">ant-1.5.3.jar</tt>
<tt class="filename">ant-optional-1.5.3.jar</tt>
<tt class="filename">ant-optional.jar</tt> â?? <tt class="filename">ant-optional-1.5.3.jar</tt></pre></div></li><li><p>
If the number of provided jars exceeds two or if they were at a point provided in a single monolithic jar the files should be placed in a sub-directory named after the package (as for a single jar).
          </p><div class="example"><a id="id2829054"></a><p class="title"><b>Example 2.2. Bunch of jars naming</b></p><pre class="screen"><tt class="filename">javamail</tt>
<tt class="filename">javamail/imap-1.3.jar</tt>
<tt class="filename">javamail/imap.jar</tt> â?? <tt class="filename">imap-1.3.jar</tt>
<tt class="filename">javamail/mailapi-1.3.jar</tt>
<tt class="filename">javamail/mailapi.jar</tt> â?? <tt class="filename">mailapi-1.3.jar</tt>
<tt class="filename">javamail/pop3-1.3.jar</tt>
<tt class="filename">javamail/pop3.jar</tt> â?? <tt class="filename">pop3-1.3.jar</tt>
<tt class="filename">javamail/smtp-1.3.jar</tt>
<tt class="filename">javamail/smtp.jar</tt> â?? <tt class="filename">smtp-1.3.jar</tt></pre></div></li><li><p>
If a project offers the choice of packaging it as a single monolithic jar or several ones, the split packaging will be prefered.
          </p></li></ol></div></div></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id2829187"></a>Chapter 3. Directory structure</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2829203">%{_javadir}</a></dt><dd><dl><dt><a href="#id2829218">/usr/share/java</a></dt><dt><a href="#id2829276">/usr/share/java-ext</a></dt><dt><a href="#id2829326">/usr/share/java-x.y.z</a></dt><dt><a href="#id2829625">/usr/share/java-utils</a></dt></dl></dd><dt><a href="#id2829662">%{_jnidir}:
 /usr/lib/java</a></dt><dt><a href="#id2829746">%{_jvmdir}</a></dt><dd><dl><dt><a href="#id2829760">/usr/lib/jvm</a></dt><dt><a href="#id2829800">/usr/lib/jvm-exports</a></dt></dl></dd><dt><a href="#id2829887">%{_sysconfdir}/java:
 /etc/java</a></dt><dt><a href="#id2829933">%{_javadocdir}</a></dt></dl></div><p>
Core directory structure is provided by the <span class="emphasis"><em>jpackage-utils</em></span> package. It consists of:
    </p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2829203"></a><tt class="systemitem">%{_javadir}</tt></h2></div></div><div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id2829218"></a><tt class="filename">/usr/share/java</tt></h3></div></div><div></div></div><p>
The <tt class="systemitem">%{_javadir}</tt> rpm macro defines the main jar repository. Historically it was the sole directory used by the 1.0 JPackage distribution, before packaging constraints forced a more complex system. It usually expands into <tt class="filename">/usr/share/java</tt>.
        </p><p>
All jar files and directories of jar files that do not depend on a particular Java standard version or JNI shall be installed in <tt class="filename">%{_javadir}</tt>.
        </p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id2829276"></a><tt class="filename">/usr/share/java-ext</tt></h3></div></div><div></div></div><p>
From <tt class="systemitem">%{_javadir}</tt> we derive <tt class="filename">%{_javadir}-ext</tt>. All jar files and directories of jar files that depend on a particular Java standard version but not JNI shall be installed in <tt class="filename">%{_javadir}-ext</tt>.
        </p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id2829326"></a><tt class="filename">/usr/share/java-x.y.z</tt></h3></div></div><div></div></div><p>
We also derive the <tt class="filename">%{_javadir}-x.y.z</tt> directories. They contain symlinks to files or directories of <tt class="filename">%{_javadir}-ext</tt> for all elements that are valid for the x.y.z Java standard version. Since an implementation is usually valid for a range of Java standard iterations, a file or directory in <tt class="filename">%{_javadir}-ext</tt> will usually have several symbolic links pointing to it. Also of note are the non-versioned symlinks : for two jars named <tt class="filename">foo13.jar</tt> and <tt class="filename">foo14.jar</tt>, the <tt class="filename">foo.jar</tt> symlink will point to <tt class="filename">foo13.jar</tt> in <tt class="filename">%{_javadir}-1.3.0</tt> and <tt class="filename">%{_javadir}-1.3.1</tt>, and <tt class="filename">foo14.jar</tt> in <tt class="filename">%{_javadir}-1.4.0</tt>, <tt class="filename">%{_javadir}-1.4.1</tt> and <tt class="filename">%{_javadir}-1.4.2</tt>.
        </p><p>
Unfortunately the Java standard has been known to change enough between minor versions that we must take into account the full version and distinguish between <tt class="filename">%{_javadir}-1.4.0</tt> and <tt class="filename">%{_javadir}-1.4.1</tt>.
        </p><div class="example"><a id="id2829490"></a><p class="title"><b>Example 3.1. Java standard version-specific repositories usage</b></p><pre class="screen"><tt class="filename">/usr/share/java-ext/jsse</tt>
<tt class="filename">/usr/share/java-ext/jsse/jcert-1.0.3.01.jar</tt>
<tt class="filename">/usr/share/java-ext/jsse/jcert.jar</tt> â?? <tt class="filename">jcert-1.0.3.01.jar</tt>
<tt class="filename">/usr/share/java-ext/jsse/jnet-1.0.3.01.jar</tt>
<tt class="filename">/usr/share/java-ext/jsse/jnet.jar</tt> â?? <tt class="filename">jnet-1.0.3.01.jar</tt>
<tt class="filename">/usr/share/java-ext/jsse/jsse-1.0.3.01.jar</tt>
<tt class="filename">/usr/share/java-ext/jsse/jsse.jar</tt> â?? <tt class="filename">jsse-1.0.3.01.jar</tt>
<tt class="filename">/usr/share/java-1.3.0/jsse</tt> â?? <tt class="filename">/usr/share/java-ext/jsse</tt>
<tt class="filename">/usr/share/java-1.3.1/jsse</tt> â?? <tt class="filename">/usr/share/java-ext/jsse</tt></pre></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id2829625"></a><tt class="filename">/usr/share/java-utils</tt></h3></div></div><div></div></div><p>
We also derive <tt class="filename">%{_javadir}-utils</tt>. It is used to host java-related scripts and functions, including the main shell-script function library <tt class="filename">java-functions</tt>.
        </p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2829662"></a><tt class="systemitem">%{_jnidir}</tt>:
 <tt class="filename">/usr/lib/java</tt></h2></div></div><div></div></div><p>
The <tt class="systemitem">%{_jnidir}</tt> rpm macro defines the main JNI jar repository. Like <tt class="systemitem">%{_javadir}</tt> it is declined in -ext and -x.y.z variants. It follows exactly the same rules as the <tt class="systemitem">%{_javadir}</tt>-derived tree structure, except that it hosts jars that use JNI.
      </p><p>
<tt class="systemitem">%{_jnidir}</tt> usually expands into <tt class="filename">/usr/lib/java</tt>.
      </p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2829746"></a><tt class="systemitem">%{_jvmdir}</tt></h2></div></div><div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id2829760"></a><tt class="filename">/usr/lib/jvm</tt></h3></div></div><div></div></div><p>
The <tt class="systemitem">%{_jvmdir}</tt> rpm macro defines the root directory under which the different system JVMs are installed. It usually expands into <tt class="filename">/usr/lib/jvm</tt>.
        </p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id2829800"></a><tt class="filename">/usr/lib/jvm-exports</tt></h3></div></div><div></div></div><p>
From <tt class="systemitem">%{_jvmdir}</tt> we derive <tt class="filename">%{_jvmdir}-exports</tt>. Each subdirectory of <tt class="filename">%{_jvmdir}</tt> must have a twin in <tt class="filename">%{_jvmdir}-exports</tt>. It is used to register Java extensions bundled with the <span class="acronym">SDK</span> or <span class="acronym">RE</span> with symbolic links pointing inside the JVM structure in <tt class="filename">%{_jvmdir}</tt>.
        </p><p>
The symbolic links shall point to the actual in-JVM jar file providing the extension (though that is not strictly necessary for the system to work), be available in versioned and non-versioned versions and follow general naming rules.
        </p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2829887"></a><tt class="systemitem">%{_sysconfdir}</tt>/java:
 <tt class="filename">/etc/java</tt></h2></div></div><div></div></div><p>
<tt class="filename">%{_sysconfdir}/java</tt> hosts the general configuration files related to the java subsystem, mainly <tt class="filename">java.conf</tt>.
      </p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2829933"></a><tt class="systemitem">%{_javadocdir}</tt></h2></div></div><div></div></div><p>
This is the root of all installed javadoc documentation. It's location and intended usage are debated right now.
      </p></div></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id2829956"></a>Chapter 4. Scripts and actual run-time classpath resolution</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id2830846">General resolution rules</a></dt><dt><a href="#id2831067">find-jar</a></dt><dt><a href="#id2831115">build-classpath</a></dt><dt><a href="#id2831247">build-jar-repository</a></dt><dt><a href="#id2831406">rebuild-jar-repository</a></dt></dl></div><p>
We assume the correct environment variables have already been set, ie at least <tt class="envar">$JAVA_HOME</tt> to select a JVM in <tt class="filename">%{_jvmdir}</tt>, and eventually the relevant <tt class="envar">$JAVACMD</tt>, <tt class="envar">$LD_ASSUME_KERNEL</tt>, <tt class="envar">$LANG</tt>, and <tt class="envar">$JAVA_COMPILER</tt> variables.
    </p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">FIXME</h3><p>
The current implementation is not sane and carries a lot of legacy garbage. A clean implementation would be to read these values in <tt class="filename">~/.apprc</tt>, falling back on <tt class="filename">/etc/app.conf</tt>, the user environment, <tt class="filename">~/.java</tt> and <tt class="filename">/etc/java/java.conf</tt>. If <tt class="envar">$JAVA_HOME</tt> was still undefined then, use<tt class="filename">/usr/lib/jvm/java</tt> as default.
      </p><p>
Unfortunately we are not doing so right now.
      </p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2830846"></a>General resolution rules</h2></div></div><div></div></div><p>
When queried for <span class="emphasis"><em>foo/bar-x.y</em></span> we search for the <tt class="filename">foo/bar-x.y.jar</tt> jar file, then the <tt class="filename">foo/bar-x.y</tt> jar directory in the following locations:
      </p><div class="itemizedlist"><ul type="disc"><li><p><b><tt class="filename">%{_jvmdir}-exports/name</tt>. </b>
The shadow of the JVM defined by <tt class="envar">$JAVA_HOME</tt>=<tt class="filename">%{_jvmdir}/name</tt>. This is the JVM-specific repository where we register the Java extensions it includes.
            </p></li><li><p><b><tt class="filename">%{_jnidir}/java-version</tt>. </b>
Where <span class="emphasis"><em>java-version</em></span> is the JVM standard Java compliance level as deduced from
</p><pre class="screen"><tt class="prompt">[bob@sys dir]$</tt> <b class="command">$JAVACMD</b> <tt class="option">-version</tt></pre><p>
            </p></li><li><p><b><tt class="filename">%{_javadir}/java-version</tt>. </b>
The java-version specific non-JNI jar repository.
            </p></li><li><p><b><tt class="filename">%{_javadir}</tt>. </b>
The general jar repository.
            </p></li></ul></div><p>
If we didn't find anything, the search is repeated for <tt class="filename">foo/bar.jar</tt>, <tt class="filename">foo/bar</tt>, <tt class="filename">foo.jar</tt> then at last the <tt class="filename">foo</tt> directory. Note the scan is performed for jar/directory pairs ie a subdirectory located in a more specific repository will always have precedence on a jar with the same name located in a less specific repository.
      </p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2831067"></a><b class="command">find-jar</b></h2></div></div><div></div></div><div class="cmdsynopsis"><p><tt class="command">find-jar</tt>  {element}</p></div><p>
The <b class="command">find-classpath</b> command tests the resolution of a given element. If successful it will return a jar file or a directory. It is solely intended for testing resolution and should not be used in scripts. Even for single-element classpath building the following command is preferred, since single-element searches can produce multiple file results when resolving into a directory.
      </p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2831115"></a><b class="command">build-classpath</b></h2></div></div><div></div></div><div class="cmdsynopsis"><p><tt class="command">build-classpath</tt>  {element...}</p></div><p>
The <b class="command">build-classpath</b> command builds a standard classpath following the general resolution rules. It takes a list of elements as arguments. If an element resolves in a directory, all its children jar files are included in the classpath.
      </p><div class="example"><a id="id2831160"></a><p class="title"><b>Example 4.1. build-classpath output</b></p><pre class="screen"><tt class="prompt">[bob@sys dir]$</tt> export JAVA_HOME=/usr/lib/jvm/java-1.3.1-blackdown
<tt class="prompt">[bob@sys dir]$</tt> build-classpath jsse javamail/mailapi jaxp_parser_impl
/usr/share/java-1.3.1/jsse/jcert-1.0.3.01.jar:/usr/share/java-1.3.1/jsse/jnet-1.0.3.01.jar:/usr/share/java-1.3.1/jsse/jsse-1.0.3.01.jar:/usr/share/java/javamail/mailapi.jar:/usr/share/java/jaxp_parser_impl.jar
<tt class="prompt">[bob@sys dir]$</tt> export JAVA_HOME=/usr/lib/jvm/java-1.4.1-sun
<tt class="prompt">[bob@sys dir]$</tt> build-classpath jsse javamail/mailapi jaxp_parser_impl
/usr/lib/jvm-exports/java-1.4.1-sun/jsse.jar:/usr/share/java/javamail/mailapi.jar:/usr/share/java/jaxp_parser_impl.jar</pre></div><p>
Like the following command it will fail, return an non-zero error code and write to the error console if one or more of the requested elements were not found. Therefore for a classpath composed of required and optional parts recommended building practice is the following:
     </p><div class="example"><a id="id2831227"></a><p class="title"><b>Example 4.2. Constructing a classpath with mandatory and optional parts</b></p><pre class="programlisting">CLASSPATH=$(build-classpath list_of_required_elements):$(build-classpath list_of_optional_elements 2&gt; /dev/null)</pre></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2831247"></a><b class="command">build-jar-repository</b></h2></div></div><div></div></div><div class="cmdsynopsis"><p><tt class="command">build-jar-repository</tt>  {directory} {element...}</p></div><p>
The <b class="command">build-jar-repository</b> command constructs a flat directory of jar file symlinks following the same rules. It takes a directory name followed by a list of elements as arguments. It will try to create a <tt class="filename">[foo][bar]xxx.jar</tt> set of symbolic links in the target directory for each <span class="emphasis"><em>foo/bar</em></span> requested element<sup>[<a id="id2831317" href="#ftn.id2831317">6</a>]</sup>. The special symlink naming makes it possible to recognize they were created by this command and is required for the following command.
      </p><p>
<b class="command">build-jar-repository</b> can be safely used on the same directory several times. Previous symlinks won't be removed. If one wants to reset the directory the symbolic links must be cleaned up manually.
      </p><div class="example"><a id="id2831344"></a><p class="title"><b>Example 4.3. build-jar-repository results</b></p><pre class="screen"><tt class="prompt">[bob@sys dir]$</tt> export JAVA_HOME=/usr/lib/jvm/java-1.3.1-blackdown
<tt class="prompt">[bob@sys dir]$</tt> build-jar-repository lib jsse javamail/mailapi
<tt class="prompt">[bob@sys dir]$</tt> build-jar-repository lib jaxp_parser_impl
<tt class="prompt">[bob@sys dir]$</tt> tree lib
[nim@rousalka nim]$ tree lib
lib
|-- [javamail][mailapi].jar -&gt; /usr/share/java/javamail/mailapi.jar
|-- [jaxp_parser_impl].jar -&gt; /usr/share/java/jaxp_parser_impl.jar
|-- [jsse]jcert-1.0.3.01.jar -&gt; /usr/share/java-1.3.1/jsse/jcert-1.0.3.01.jar
|-- [jsse]jcert.jar -&gt; /usr/share/java-1.3.1/jsse/jcert.jar
|-- [jsse]jnet-1.0.3.01.jar -&gt; /usr/share/java-1.3.1/jsse/jnet-1.0.3.01.jar
|-- [jsse]jnet.jar -&gt; /usr/share/java-1.3.1/jsse/jnet.jar
|-- [jsse]jsse-1.0.3.01.jar -&gt; /usr/share/java-1.3.1/jsse/jsse-1.0.3.01.jar
`-- [jsse]jsse.jar -&gt; /usr/share/java-1.3.1/jsse/jsse.jar</pre></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2831406"></a><b class="command">rebuild-jar-repository</b></h2></div></div><div></div></div><div class="cmdsynopsis"><p><tt class="command">rebuild-jar-repository</tt>  {directory}</p></div><p>
The <b class="command">rebuild-jar-repository</b> command refreshes a jar repository created with <b class="command">build-jar-repository</b>. It takes the directory name as argument. It is intended to be run after <tt class="envar">$JAVA_HOME</tt> was changed to insure all symlinked jar files are still compatible with the new JVM.
      </p>

 export JAVA_HOME=/usr/lib/jvm/java-1.4.1-sun
     <div class="example"><a id="id2831465"></a><p class="title"><b>Example 4.4. rebuild-jar-repository results</b></p><pre class="screen"><tt class="prompt">[bob@sys dir]$</tt> export export JAVA_HOME=/usr/lib/jvm/java-1.4.1-sun
<tt class="prompt">[bob@sys dir]$</tt> rebuild-jar-repository lib
<tt class="prompt">[bob@sys dir]$</tt> tree lib
lib
|-- [javamail][mailapi].jar -&gt; /usr/share/java/javamail/mailapi.jar
|-- [jaxp_parser_impl].jar -&gt; /usr/share/java/jaxp_parser_impl.jar
`-- [jsse].jar -&gt; /usr/lib/jvm-exports/java-1.4.1-sun/jsse.jar</pre></div></div><div class="footnotes"><br /><hr width="100" align="left" /><div class="footnote"><p><sup>[<a id="ftn.id2831317" href="#id2831317">6</a>] </sup>
Remember, a single element can resolve in a full directory of jar files.
          </p></div></div></div></div></body></html>

Attachment: signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=


Reply to: