|
| 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. |
0 commit comments