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