Here's ChatGPT's answer... :-)
To create a common `reportSet` that is applied to all child projects
but not activated in the parent POM itself, you can use a few Maven
techniques, such as creating a profile or leveraging inheritance in a
way that allows the children to inherit the `reportSet` but prevents
the parent project from running the reports.
Here’s a general approach you can take to solve this:
### 1. Use a Reporting Plugin in a Profile
You can define the `reportSet` inside a profile in the parent POM and
activate the profile only for the child projects. This way, the
reporting configuration will be inherited by the children, but the
parent won't execute the reports unless the profile is explicitly
activated for the parent.
Steps:
- Define a profile for reporting in the parent POM.
- The profile should include your `reportSet`.
- Use conditions (such as activation by default for child modules
only) to ensure that the reports are only active in child projects.
Example:
```xml
com.example
parent-project
1.0-SNAPSHOT
pom
child-reporting
!skip-reports
org.apache.maven.plugins
maven-site-plugin
3.9.1
my-reports
report1
report2
```
### 2. Activate the Profile in Child Projects
In each child module, you can ensure that the profile is activated by
default. If you want the parent to never run the reports, you can
activate the profile in child projects only.
In each child POM, add the following:
```xml
com.example
parent-project
1.0-SNAPSHOT
false
```
### 3. Optional: Skipping Reports in the Parent
If you want to ensure that reports are always skipped in the parent
but activated in the children, you can define a property in the parent
that disables the profile:
```xml
true
```
### Summary of the Approach:
- **Parent POM**: Define a reporting profile that includes the `reportSet`.
- **Profile Activation**: Control profile activation via a property
(`skip-reports`) that is defined in the parent but can be overridden
in the children.
- **Child Modules**: In child projects, override the property to
enable reporting by setting `skip-reports` to `false`.
This way, your child modules inherit and apply the `reportSet`, but
the parent POM does not run reports unless you explicitly activate the
profile.
Le ven. 6 sept. 2024 à 11:10, Konrad Windszus a écrit :
>
> Hi,
> Unlike plugin (with plugin management and its configuration) the reportSet
> (https://maven.apache.org/ref/3.9.9/maven-model/maven.html#class_reportSet)
> cannot be configured on a POM level which itself should not have the
> configured reports.
> Once a reportSuite is configured it is active both on the current project and
> inheriting ones. What I want to achieve is a common report set for all
> children without being active on the parent itself.
> Any idea?
>
> Thanks in advance,
> Konrad
> -
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org
>
--
Guillaume Nodet
-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org