-
Notifications
You must be signed in to change notification settings - Fork 243
/
guide-multiple-modules.apt
88 lines (55 loc) · 3.63 KB
/
guide-multiple-modules.apt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
------
Guide to Working with Multiple Modules
------
Brett Porter
Karl Heinz Marbaise
------
2015-03-13
------
~~ Licensed to the Apache Software Foundation (ASF) under one
~~ or more contributor license agreements. See the NOTICE file
~~ distributed with this work for additional information
~~ regarding copyright ownership. The ASF licenses this file
~~ to you under the Apache License, Version 2.0 (the
~~ "License"); you may not use this file except in compliance
~~ with the License. You may obtain a copy of the License at
~~
~~ http://www.apache.org/licenses/LICENSE-2.0
~~
~~ Unless required by applicable law or agreed to in writing,
~~ software distributed under the License is distributed on an
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~~ KIND, either express or implied. See the License for the
~~ specific language governing permissions and limitations
~~ under the License.
~~ NOTE: For help with the syntax of this file, see:
~~ http://maven.apache.org/doxia/references/apt-format.html
Guide to Working with Multiple Modules
(If you're working with Maven 4, please refer to the {{{./guide-multiple-modules-4.html} Maven 4 edition of this guide}})
As seen in the introduction to the POM, Maven supports project aggregation in addition to project inheritance. This section outlines how Maven processes projects with multiple modules, and how you can work with them more effectively.
* The Reactor
The mechanism in Maven that handles multi-module projects is referred to as the <reactor>. This part of the Maven core does the following:
* Collects all the available modules to build
* Sorts the projects into the correct build order
* Builds the selected projects in order
** Reactor Sorting
Because modules within a multi-module build can depend on each other, it is important that the reactor sorts all the projects in a way that guarantees any project is built before it is required.
The following relationships are honoured when sorting projects:
* a project dependency on another module in the build
* a plugin declaration where the plugin is another module in the build
* a plugin dependency on another module in the build
* a build extension declaration on another module in the build
* the order declared in the <<<\<modules\>>>> element (if no other rule applies)
Note that only "instantiated" references are used - <<<dependencyManagement>>> and <<<pluginManagement>>> elements do not cause a change to the reactor sort order.
** Command Line Options
No special configuration is required to take advantage of the reactor, however it is possible to customize its behavior.
The following command line switches are available:
* <<<--resume-from>>> - resumes a reactor from the specified project (e.g. when it fails in the middle)
* <<<--also-make>>> - build the specified projects, and any of their dependencies in the reactor
* <<<--also-make-dependents>>> - build the specified projects, and any that depend on them
* <<<--fail-fast>>> - the default behavior - whenever a module build fails, stop the overall build immediately
* <<<--fail-at-end>>> - if a particular module build fails, continue the rest of the reactor and report all failed modules at the end instead
* <<<--non-recursive>>> - do not use a reactor build, even if the current project declares modules and just build the project in the current directory
Refer to the Maven command line interface reference for more information on these switches.
* More information
* {{{http://books.sonatype.com/mvnex-book/reference/multimodule.html} Chapter 6. A Multi-module Project (Maven by Example)}}