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