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