[cb7032fe] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
| 7 | <!ENTITY maven-download-http "https://archive.apache.org/dist/maven/maven-3/&maven-version;/source/apache-maven-&maven-version;-src.tar.gz">
|
---|
| 8 | <!ENTITY maven-download-ftp " ">
|
---|
| 9 | <!ENTITY maven-md5sum "240b880cd7294665d7228f74f6453984">
|
---|
| 10 | <!ENTITY maven-size "2.6 MB">
|
---|
| 11 | <!ENTITY maven-buildsize "?? MB">
|
---|
| 12 | <!ENTITY maven-time "?? SBU">
|
---|
| 13 |
|
---|
| 14 | <!ENTITY maven-binary-http "https://archive.apache.org/dist/maven/maven-3/&maven-version;/binaries/apache-maven-&maven-version;-bin.tar.gz">
|
---|
| 15 | ]>
|
---|
| 16 |
|
---|
| 17 | <!-- Try to keep the indentation used in this file-->
|
---|
| 18 | <sect1 id="maven" xreflabel="Apache-Maven-&maven-version;">
|
---|
| 19 | <?dbhtml filename="maven.html"?>
|
---|
| 20 |
|
---|
| 21 | <sect1info>
|
---|
| 22 | <!-- this part gets updated when you commit, IFF you set the properties:
|
---|
| 23 | first, svn add path/to/thisfile.xml and then
|
---|
| 24 | svn propset svn:mime-type text/plain path/to/thisfile.xml and
|
---|
| 25 | svn propset svn:keywords "Date LastChangedBy" path/to/thisfile.xml -->
|
---|
| 26 | <othername>$LastChangedBy: pierre $</othername>
|
---|
| 27 | <date>$Date: 2017-09-11 12:14:03 +0200 (lun. 11 sept. 2017) $</date>
|
---|
| 28 | </sect1info>
|
---|
| 29 |
|
---|
| 30 | <title>Apache-Maven-&maven-version;</title>
|
---|
| 31 |
|
---|
| 32 | <indexterm zone="maven">
|
---|
[b238072a] | 33 | <primary sortas="a-apache-maven">Apache-Maven</primary>
|
---|
[cb7032fe] | 34 | </indexterm>
|
---|
| 35 |
|
---|
| 36 | <sect2 role="package">
|
---|
| 37 | <title>Introduction to Apache-Maven</title>
|
---|
| 38 |
|
---|
| 39 | <para>
|
---|
| 40 | <application>Apache-Maven</application> is a tool that can be used for
|
---|
| 41 | building and managing any Java-based project. Based on the concept of a
|
---|
| 42 | project object model (POM), <application>Apache-Maven</application> can
|
---|
| 43 | manage a project's build, reporting and documentation from a central
|
---|
| 44 | piece of information.
|
---|
| 45 | </para>
|
---|
| 46 |
|
---|
| 47 | &lfs82_checked;
|
---|
| 48 |
|
---|
| 49 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 50 | <itemizedlist spacing="compact">
|
---|
| 51 | <listitem>
|
---|
| 52 | <para>
|
---|
| 53 | Download (HTTP): <ulink url="&maven-download-http;"/>
|
---|
| 54 | </para>
|
---|
| 55 | </listitem>
|
---|
| 56 | <listitem>
|
---|
| 57 | <para>
|
---|
| 58 | Download (FTP): <ulink url="&maven-download-ftp;"/>
|
---|
| 59 | </para>
|
---|
| 60 | </listitem>
|
---|
| 61 | <listitem>
|
---|
| 62 | <para>
|
---|
| 63 | Download MD5 sum: &maven-md5sum;
|
---|
| 64 | </para>
|
---|
| 65 | </listitem>
|
---|
| 66 | <listitem>
|
---|
| 67 | <para>
|
---|
| 68 | Download size: &maven-size;
|
---|
| 69 | </para>
|
---|
| 70 | </listitem>
|
---|
| 71 | <listitem>
|
---|
| 72 | <para>
|
---|
| 73 | Estimated disk space required: &maven-buildsize;
|
---|
| 74 | </para>
|
---|
| 75 | </listitem>
|
---|
| 76 | <listitem>
|
---|
| 77 | <para>
|
---|
| 78 | Estimated build time: &maven-time;
|
---|
| 79 | </para>
|
---|
| 80 | </listitem>
|
---|
| 81 | </itemizedlist>
|
---|
| 82 |
|
---|
| 83 |
|
---|
| 84 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
| 85 | <itemizedlist spacing="compact">
|
---|
| 86 | <listitem>
|
---|
| 87 | <para>
|
---|
| 88 | <application>Appache-Maven</application> needs to be built with
|
---|
| 89 | itself, so a binary is needed:
|
---|
| 90 | <ulink url="&maven-binary-http;"/>
|
---|
| 91 | </para>
|
---|
| 92 | </listitem>
|
---|
| 93 | </itemizedlist>
|
---|
| 94 |
|
---|
| 95 |
|
---|
| 96 | <bridgehead renderas="sect3">Apache-Maven Dependencies</bridgehead>
|
---|
| 97 |
|
---|
| 98 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
| 99 | <para role="required">
|
---|
| 100 | A JDK (<xref linkend="java-bin"/> or <xref linkend="openjdk"/>)
|
---|
| 101 | </para>
|
---|
| 102 |
|
---|
| 103 | <para condition="html" role="usernotes">
|
---|
| 104 | User Notes: <ulink url="&blfs-wiki;/ApacheMaven"/>
|
---|
| 105 | </para>
|
---|
| 106 | </sect2>
|
---|
| 107 |
|
---|
| 108 | <sect2 role="installation">
|
---|
| 109 | <title>Installation of Apache-Maven</title>
|
---|
| 110 |
|
---|
[636e16f7] | 111 | <para>
|
---|
| 112 | First fix two issues which prevent building with Java 10:
|
---|
| 113 | </para>
|
---|
| 114 |
|
---|
| 115 | <screen><userinput>sed -e '/-surefire-/a<version>2.21.0</version>' \
|
---|
| 116 | -e '/<commonsLang/s/3\.5/3.7/' \
|
---|
| 117 | -i pom.xml</userinput></screen>
|
---|
| 118 |
|
---|
[cb7032fe] | 119 | <para>
|
---|
| 120 | Install <application>Apache-Maven</application> by running the following
|
---|
| 121 | commands:
|
---|
| 122 | </para>
|
---|
| 123 |
|
---|
| 124 | <screen><userinput>install -vdm 755 ../apache-maven-bin &&
|
---|
| 125 | tar -xf ../apache-maven-&maven-version;-bin.tar.gz \
|
---|
| 126 | --strip-components=1 \
|
---|
| 127 | --directory ../apache-maven-bin &&
|
---|
| 128 |
|
---|
| 129 | SAVEPATH=$PATH &&
|
---|
| 130 | PATH=../apache-maven-bin/bin:$PATH &&
|
---|
| 131 |
|
---|
| 132 | mvn -DdistributionTargetDir=build \
|
---|
| 133 | package</userinput></screen>
|
---|
| 134 |
|
---|
| 135 | <para>
|
---|
| 136 | The test are run as part of the compilation above.
|
---|
| 137 | </para>
|
---|
| 138 |
|
---|
| 139 | <para>
|
---|
| 140 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 141 | </para>
|
---|
| 142 |
|
---|
| 143 | <screen role="root"><userinput>install -vdm 755 /opt/maven-&maven-version; &&
|
---|
| 144 | cp -Rv apache-maven/build/* /opt/maven-&maven-version; &&
|
---|
| 145 | ln -sfvn maven-&maven-version; /opt/maven</userinput></screen>
|
---|
| 146 |
|
---|
| 147 | <para>
|
---|
| 148 | You can know reset the <envar>PATH</envar> variable and clean
|
---|
| 149 | the source directory:
|
---|
| 150 | </para>
|
---|
| 151 |
|
---|
| 152 | <screen><userinput>PATH=$SAVEPATH &&
|
---|
| 153 | rm -rf ../apache-maven-bin</userinput></screen>
|
---|
| 154 |
|
---|
| 155 | </sect2>
|
---|
| 156 |
|
---|
| 157 | <sect2 role="commands">
|
---|
| 158 | <title>Command Explanations</title>
|
---|
| 159 |
|
---|
| 160 | <para>
|
---|
| 161 | <command>tar ../apache-maven-&maven-version;-bin.tar.gz ...
|
---|
| 162 | PATH=.../bin:$PATH</command>: Extracts the
|
---|
| 163 | <application>Apache-Maven</application> binary and let the system know
|
---|
| 164 | about the binary location.
|
---|
| 165 | </para>
|
---|
| 166 |
|
---|
| 167 | <para>
|
---|
| 168 | <command>mvn ... package</command>: Compiles and tests the package, and
|
---|
| 169 | packages it to its final format.
|
---|
| 170 | </para>
|
---|
| 171 |
|
---|
| 172 | <para>
|
---|
| 173 | <parameter>-DdistributionTargetDir=build</parameter>: Specifies
|
---|
| 174 | the location where the built binary should be packaged. The content of
|
---|
| 175 | this directory is ready to be copied to its final location.
|
---|
| 176 | </para>
|
---|
| 177 |
|
---|
| 178 | <para>
|
---|
| 179 | <command>ln -sfvn maven-&maven-version; /opt/maven</command>: Creates
|
---|
| 180 | a convenience symlink.
|
---|
| 181 | </para>
|
---|
| 182 |
|
---|
| 183 | <para>
|
---|
| 184 | <option>-Dmaven.repo.local=...</option>: Specifies a maven local
|
---|
| 185 | repository for this build, instead of the default <filename
|
---|
| 186 | class="directory">~/.m2/repository</filename>. You may want to use this
|
---|
| 187 | if several users are to use <application>Apache-Maven</application>.
|
---|
| 188 | </para>
|
---|
| 189 |
|
---|
| 190 | </sect2>
|
---|
| 191 |
|
---|
| 192 | <sect2 role="configuration">
|
---|
| 193 | <title>Configuring Apache-Maven</title>
|
---|
| 194 |
|
---|
| 195 | <sect3 id="maven-config">
|
---|
| 196 | <title>Config Files</title>
|
---|
| 197 | <para>
|
---|
| 198 | The user settings file <filename>~/.m2/settings.xml</filename> and
|
---|
| 199 | the global settings file
|
---|
| 200 | <filename>/opt/maven/conf/settings.xml</filename>
|
---|
| 201 | </para>
|
---|
| 202 |
|
---|
| 203 | <indexterm zone="maven maven-config">
|
---|
| 204 | <primary sortas="e-AA.m2-settings.xml">~/.m2-settings.xml</primary>
|
---|
| 205 | </indexterm>
|
---|
| 206 |
|
---|
| 207 | <indexterm zone="maven maven-config">
|
---|
| 208 | <primary
|
---|
| 209 | sortas="e-opt-maven-conf-settings.xml">/opt/maven/conf/settings.xml</primary>
|
---|
| 210 | </indexterm>
|
---|
| 211 | </sect3>
|
---|
| 212 |
|
---|
| 213 | <sect3><title>Configuration Information</title>
|
---|
| 214 |
|
---|
| 215 | <para>
|
---|
| 216 | The default configuration file shipped with
|
---|
| 217 | <application>Apache-Maven</application> should be sufficent for
|
---|
| 218 | common tasks. You may want to copy the global settings file to
|
---|
| 219 | your user one and modify it to suit your needs.
|
---|
| 220 | </para>
|
---|
| 221 |
|
---|
| 222 | <para>
|
---|
| 223 | You should add the <command>mvn</command> command to
|
---|
| 224 | <envar>PATH</envar>. For example:
|
---|
| 225 | </para>
|
---|
| 226 |
|
---|
| 227 | <screen role="root"><userinput>cat > /etc/profile.d/maven.sh << "EOF"
|
---|
| 228 | <literal># Begin /etc/profile.d/maven.sh
|
---|
| 229 |
|
---|
| 230 | pathappend /opt/maven/bin
|
---|
| 231 |
|
---|
| 232 | # End /etc/profile.d/maven.sh</literal>
|
---|
| 233 | EOF</userinput></screen>
|
---|
| 234 |
|
---|
| 235 | </sect3>
|
---|
| 236 |
|
---|
| 237 | </sect2>
|
---|
| 238 |
|
---|
| 239 | <sect2 role="content">
|
---|
| 240 | <title>Contents</title>
|
---|
| 241 |
|
---|
| 242 | <segmentedlist>
|
---|
[24fd742] | 243 | <segtitle>Installed Programs</segtitle>
|
---|
| 244 | <segtitle>Installed Library</segtitle>
|
---|
| 245 | <segtitle>Installed Directory</segtitle>
|
---|
[cb7032fe] | 246 |
|
---|
| 247 | <seglistitem>
|
---|
| 248 | <seg>
|
---|
| 249 | mvn, mvnDebug, and mvnyjp
|
---|
| 250 | </seg>
|
---|
| 251 | <seg>
|
---|
[24fd742] | 252 | libjansi.so in <filename
|
---|
| 253 | class="directory">/opt/maven/lib/jansi-native</filename>
|
---|
[cb7032fe] | 254 | </seg>
|
---|
| 255 | <seg>
|
---|
| 256 | /opt/maven-&maven-version;
|
---|
| 257 | </seg>
|
---|
| 258 | </seglistitem>
|
---|
| 259 | </segmentedlist>
|
---|
| 260 |
|
---|
| 261 | <variablelist>
|
---|
| 262 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 263 | <?dbfo list-presentation="list"?>
|
---|
| 264 | <?dbhtml list-presentation="table"?>
|
---|
| 265 |
|
---|
| 266 | <varlistentry id="mvn">
|
---|
| 267 | <term><command>mvn</command></term>
|
---|
| 268 | <listitem>
|
---|
| 269 | <para>
|
---|
| 270 | is the <application>Apache-Maven</application> Java-based project
|
---|
| 271 | builder and manager
|
---|
| 272 | </para>
|
---|
| 273 | <indexterm zone="maven mvn">
|
---|
| 274 | <primary sortas="b-mvn">mvn</primary>
|
---|
| 275 | </indexterm>
|
---|
| 276 | </listitem>
|
---|
| 277 | </varlistentry>
|
---|
| 278 |
|
---|
| 279 | <varlistentry id="mvnDebug">
|
---|
| 280 | <term><command>mvnDebug</command></term>
|
---|
| 281 | <listitem>
|
---|
| 282 | <para>
|
---|
| 283 | turns on <command>mvn</command> debug mode
|
---|
| 284 | </para>
|
---|
| 285 | <indexterm zone="maven mvnDebug">
|
---|
| 286 | <primary sortas="b-mvnDebug">mvnDebug</primary>
|
---|
| 287 | </indexterm>
|
---|
| 288 | </listitem>
|
---|
| 289 | </varlistentry>
|
---|
| 290 |
|
---|
| 291 | <varlistentry id="mvnyjp">
|
---|
| 292 | <term><command>mvnyjp</command></term>
|
---|
| 293 | <listitem>
|
---|
| 294 | <para>
|
---|
| 295 | runs <command>mvn</command>under the supervision of the
|
---|
| 296 | <ulink url="https://www.yourkit.com/java/profiler/">YourKit Java
|
---|
| 297 | Profiler</ulink>
|
---|
| 298 | </para>
|
---|
| 299 | <indexterm zone="maven mvnyjp">
|
---|
| 300 | <primary sortas="b-mvnyjp">mvnyjp</primary>
|
---|
| 301 | </indexterm>
|
---|
| 302 | </listitem>
|
---|
| 303 | </varlistentry>
|
---|
| 304 |
|
---|
| 305 | </variablelist>
|
---|
| 306 | </sect2>
|
---|
| 307 | </sect1>
|
---|