Skip to content

Commit 3ff66a9

Browse files
Bukamamichael-o
authored andcommitted
[MSITE-1010] Add documentation how site deployment inheritance works
Co-authored-by: Michael Osipov <[email protected]> This closes #194
1 parent 96b6971 commit 3ff66a9

File tree

2 files changed

+81
-3
lines changed

2 files changed

+81
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
------
2+
Inheritance of Site Distribution Management
3+
------
4+
Matthias Bünger
5+
------
6+
2024-07-07
7+
------
8+
9+
~~ Licensed to the Apache Software Foundation (ASF) under one
10+
~~ or more contributor license agreements. See the NOTICE file
11+
~~ distributed with this work for additional information
12+
~~ regarding copyright ownership. The ASF licenses this file
13+
~~ to you under the Apache License, Version 2.0 (the
14+
~~ "License"); you may not use this file except in compliance
15+
~~ with the License. You may obtain a copy of the License at
16+
~~
17+
~~ http://www.apache.org/licenses/LICENSE-2.0
18+
~~
19+
~~ Unless required by applicable law or agreed to in writing,
20+
~~ software distributed under the License is distributed on an
21+
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22+
~~ KIND, either express or implied. See the License for the
23+
~~ specific language governing permissions and limitations
24+
~~ under the License.
25+
26+
~~ NOTE: For help with the syntax of this file, see:
27+
~~ http://maven.apache.org/doxia/references/apt-format.html
28+
29+
30+
Inheritance of the Site Distribution Management
31+
32+
Inside your POM you can not only configure the <<<distributionManagement>>> for the releases and snapshots
33+
of your project, but also where to deploy your site when using the <<<{{{../deploy-mojo.html}site:deploy}}>>>
34+
goal. The following configuration would deploy the project's site to a local directory called <<<bar>>>.
35+
36+
+-----+
37+
<distributionManagement>
38+
<site>
39+
<id>local</id>
40+
<url>file:///C:/foo/bar</url>
41+
</site>
42+
</distributionManagement>
43+
+-----+
44+
45+
The content of this directory would look similar to the following after your deployment:
46+
47+
-----
48+
bar/ (root of site)
49+
├── css
50+
└── report.html
51+
-----
52+
53+
You see that all files are placed directly inside the directory and that no subdirectory named after the <<<artifactId>>> is created.
54+
That's a small, but important difference in comparison how the regular <<<deploy>>> phase of the build lifecycle works
55+
where always a subdirectory is created for each project. So you have to be aware not to use the exact same value
56+
for the site for multiple projects, as otherwise files of the first deployed project will be overwritten by the files
57+
of the second deployed one and so on.
58+
59+
To handle this easily you can use a the same parent POM with each of your projects.
60+
When using a parent POM with a project, the site configuration is inherited from the parent, but each child project
61+
is located in a subdirectory with its <<<artifactId>>> name, resulting in a structure like in the following example:
62+
63+
-----
64+
bar/ (root of site)
65+
├── css
66+
├── project-A
67+
│   ├── css
68+
│   └── report.html
69+
├── project-B
70+
│   ├── css
71+
│   └── report.html
72+
└── report.html
73+
-----
74+
75+
As you can see the site content of the parent POM is located in the root of the site directory, while the content of
76+
each project using the parent POM (called "project-A" and "project-B" in the example) is located inside a subdirectory.

src/site/site.xml

+5-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ specific language governing permissions and limitations
1919
under the License.
2020
-->
2121

22-
<project xmlns="http://maven.apache.org/DECORATION/1.6.0"
23-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24-
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.6.0 http://maven.apache.org/xsd/decoration-1.6.0.xsd">
22+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23+
xmlns="http://maven.apache.org/DECORATION/1.6.0"
24+
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.6.0 http://maven.apache.org/xsd/decoration-1.6.0.xsd">
2525
<body>
2626
<menu name="Overview">
2727
<item name="Introduction" href="index.html"/>
@@ -41,6 +41,8 @@ under the License.
4141
<item name="Building a multi-module site" href="/examples/multimodule.html"/>
4242
<item name="Configuring Site Run" href="/examples/siterun.html"/>
4343
<item name="Excluding Document Formats" href="/examples/moduleexcludes.html"/>
44+
<item name="Inheritance of the Site Distribution Management"
45+
href="/examples/inheritance-site-distribution-management.html"/>
4446
</menu>
4547

4648
<menu name="Reports">

0 commit comments

Comments
 (0)