glfs/archive/maven.xml

303 lines
8.9 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../../general.ent">
%general-entities;
<!ENTITY maven-download-http "https://archive.apache.org/dist/maven/maven-3/&maven-version;/source/apache-maven-&maven-version;-src.tar.gz">
<!ENTITY maven-download-ftp " ">
<!ENTITY maven-md5sum "a4346b6cb557266677dc9541526e2548">
<!ENTITY maven-size "2.6 MB">
<!ENTITY maven-buildsize "92 MB">
<!ENTITY maven-time "0.4 SBU">
<!ENTITY maven-binary-http "https://archive.apache.org/dist/maven/maven-3/&maven-version;/binaries/apache-maven-&maven-version;-bin.tar.gz">
]>
<sect1 id="maven" xreflabel="Apache-Maven-&maven-version;">
<?dbhtml filename="maven.html"?>
<sect1info>
<othername>$LastChangedBy: pierre $</othername>
<date>$Date: 2017-09-11 12:14:03 +0200 (lun. 11 sept. 2017) $</date>
</sect1info>
<title>Apache-Maven-&maven-version;</title>
<indexterm zone="maven">
<primary sortas="a-apache-maven">Apache-Maven</primary>
</indexterm>
<sect2 role="package">
<title>Introduction to Apache-Maven</title>
<para>
<application>Apache-Maven</application> is a tool that can be used for
building and managing any Java-based project. Based on the concept of a
project object model (POM), <application>Apache-Maven</application> can
manage a project's build, reporting and documentation from a central
piece of information.
</para>
&lfs83_checked;
<bridgehead renderas="sect3">Package Information</bridgehead>
<itemizedlist spacing="compact">
<listitem>
<para>
Download (HTTP): <ulink url="&maven-download-http;"/>
</para>
</listitem>
<listitem>
<para>
Download (FTP): <ulink url="&maven-download-ftp;"/>
</para>
</listitem>
<listitem>
<para>
Download MD5 sum: &maven-md5sum;
</para>
</listitem>
<listitem>
<para>
Download size: &maven-size;
</para>
</listitem>
<listitem>
<para>
Estimated disk space required: &maven-buildsize;
</para>
</listitem>
<listitem>
<para>
Estimated build time: &maven-time;
</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">Additional Downloads</bridgehead>
<itemizedlist spacing="compact">
<listitem>
<para>
<application>Appache-Maven</application> needs to be built with
itself, so a binary is needed:
<ulink url="&maven-binary-http;"/>
</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">Apache-Maven Dependencies</bridgehead>
<bridgehead renderas="sect4">Required</bridgehead>
<para role="required">
A JDK (<xref linkend="java-bin"/> or <xref linkend="openjdk"/>)
</para>
<para condition="html" role="usernotes">
User Notes: <ulink url="&blfs-wiki;/ApacheMaven"/>
</para>
</sect2>
<sect2 role="installation">
<title>Installation of Apache-Maven</title>
<para>
First fix two issues which prevent building with Java 10:
</para>
<screen><userinput>sed -e '/-surefire-/a&lt;version&gt;2.21.0&lt;/version&gt;' \
-e '/&lt;commonsLang/s/3\.5/3.7/' \
-i pom.xml</userinput></screen>
<para>
Install <application>Apache-Maven</application> by running the following
commands:
</para>
<screen><userinput>install -vdm 755 ../apache-maven-bin &amp;&amp;
tar -xf ../apache-maven-&maven-version;-bin.tar.gz \
--strip-components=1 \
--directory ../apache-maven-bin &amp;&amp;
SAVEPATH=$PATH &amp;&amp;
PATH=../apache-maven-bin/bin:$PATH &amp;&amp;
mvn -DdistributionTargetDir=build \
package</userinput></screen>
<para>
The test are run as part of the compilation above.
</para>
<para>
Now, as the <systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>install -vdm 755 /opt/maven-&maven-version; &amp;&amp;
cp -Rv apache-maven/build/* /opt/maven-&maven-version; &amp;&amp;
ln -sfvn maven-&maven-version; /opt/maven</userinput></screen>
<para>
You can know reset the <envar>PATH</envar> variable and clean
the source directory:
</para>
<screen><userinput>PATH=$SAVEPATH &amp;&amp;
rm -rf ../apache-maven-bin</userinput></screen>
</sect2>
<sect2 role="commands">
<title>Command Explanations</title>
<para>
<command>tar ../apache-maven-&maven-version;-bin.tar.gz ...
PATH=.../bin:$PATH</command>: Extracts the
<application>Apache-Maven</application> binary and let the system know
about the binary location.
</para>
<para>
<command>mvn ... package</command>: Compiles and tests the package, and
packages it to its final format.
</para>
<para>
<parameter>-DdistributionTargetDir=build</parameter>: Specifies
the location where the built binary should be packaged. The content of
this directory is ready to be copied to its final location.
</para>
<para>
<command>ln -sfvn maven-&maven-version; /opt/maven</command>: Creates
a convenience symlink.
</para>
<para>
<option>-Dmaven.repo.local=...</option>: Specifies a maven local
repository for this build, instead of the default <filename
class="directory">~/.m2/repository</filename>. You may want to use this
if several users are to use <application>Apache-Maven</application>.
</para>
</sect2>
<sect2 role="configuration">
<title>Configuring Apache-Maven</title>
<sect3 id="maven-config">
<title>Config Files</title>
<para>
The user settings file <filename>~/.m2/settings.xml</filename> and
the global settings file
<filename>/opt/maven/conf/settings.xml</filename>
</para>
<indexterm zone="maven maven-config">
<primary sortas="e-AA.m2-settings.xml">~/.m2-settings.xml</primary>
</indexterm>
<indexterm zone="maven maven-config">
<primary
sortas="e-opt-maven-conf-settings.xml">/opt/maven/conf/settings.xml</primary>
</indexterm>
</sect3>
<sect3><title>Configuration Information</title>
<para>
The default configuration file shipped with
<application>Apache-Maven</application> should be sufficent for
common tasks. You may want to copy the global settings file to
your user one and modify it to suit your needs.
</para>
<para>
You should add the <command>mvn</command> command to
<envar>PATH</envar>. For example:
</para>
<screen role="root"><userinput>cat &gt; /etc/profile.d/maven.sh &lt;&lt; "EOF"
<literal># Begin /etc/profile.d/maven.sh
pathappend /opt/maven/bin
# End /etc/profile.d/maven.sh</literal>
EOF</userinput></screen>
</sect3>
</sect2>
<sect2 role="content">
<title>Contents</title>
<segmentedlist>
<segtitle>Installed Programs</segtitle>
<segtitle>Installed Library</segtitle>
<segtitle>Installed Directory</segtitle>
<seglistitem>
<seg>
mvn, mvnDebug, and mvnyjp
</seg>
<seg>
libjansi.so in <filename
class="directory">/opt/maven/lib/jansi-native</filename>
</seg>
<seg>
/opt/maven-&maven-version;
</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="mvn">
<term><command>mvn</command></term>
<listitem>
<para>
is the <application>Apache-Maven</application> Java-based project
builder and manager
</para>
<indexterm zone="maven mvn">
<primary sortas="b-mvn">mvn</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="mvnDebug">
<term><command>mvnDebug</command></term>
<listitem>
<para>
turns on <command>mvn</command> debug mode
</para>
<indexterm zone="maven mvnDebug">
<primary sortas="b-mvnDebug">mvnDebug</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="mvnyjp">
<term><command>mvnyjp</command></term>
<listitem>
<para>
runs <command>mvn</command>under the supervision of the
<ulink url="https://www.yourkit.com/java/profiler/">YourKit Java
Profiler</ulink>
</para>
<indexterm zone="maven mvnyjp">
<primary sortas="b-mvnyjp">mvnyjp</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>