Skip to content

Feat: Ability to disable site lifecycle#11970

Merged
cstamas merged 2 commits into
apache:maven-3.10.xfrom
cstamas:maven-3.10.x-site-lifecycle-disable
Apr 21, 2026
Merged

Feat: Ability to disable site lifecycle#11970
cstamas merged 2 commits into
apache:maven-3.10.xfrom
cstamas:maven-3.10.x-site-lifecycle-disable

Conversation

@cstamas
Copy link
Copy Markdown
Member

@cstamas cstamas commented Apr 20, 2026

Ability to suppress site lifecycle from Maven "default lifecycles". This PR does not remove "site" lifecycle component, but Maven will not consider site lifecycle among "defaults", if disabled.

Note: hence, with this option enabled, the IT suite will never (and cannot) pass, as IT suite contains ITs running/expecting site lifecycle.

Fixes #11759

Ability to suppress site lifecycle from Maven "default lifecycles".

Note: this does not remove "site" Lifecycle component, but Maven will
not consider site lifecycle, if disabled.

Fixes apache#11759
@cstamas cstamas self-assigned this Apr 20, 2026
@cstamas cstamas linked an issue Apr 20, 2026 that may be closed by this pull request
@cstamas cstamas added this to the 3.10.0 milestone Apr 20, 2026
@cstamas cstamas added the enhancement New feature or request label Apr 20, 2026
@cstamas cstamas marked this pull request as ready for review April 20, 2026 22:35
@cstamas cstamas changed the title Feat: Disable site lifecycle Feat: Ability to disable site lifecycle Apr 20, 2026
Comment on lines +55 to +56
private static final boolean SITE_ENABLED =
Boolean.parseBoolean(System.getProperty("maven.site.lifecycle.enabled", "true"));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also use a user properties for it?
or repos session config props?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is too late. This component is constructed as part of object graph before any session is being created... Will look more around tomorrow

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked around, and in many places session is not present/passed over. While we could alter these classes, that would lead to many potential breakages.

I consider this use case "special" or "very edge", so IMO Java System property is good to cover it.

private static final List<String> BUILT_IN_LIFECYCLES =
Arrays.asList(CleanLifecycleProvider.NAME, DefaultLifecycleProvider.NAME, SiteLifecycleProvider.NAME);
private static final boolean SITE_ENABLED =
Boolean.parseBoolean(System.getProperty("maven.site.lifecycle.enabled", "true"));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not Boolean.getBoolean()?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to default it to true?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, you can't, but maybe we should invert the logic anyway? Site lifecycle is always enabled unless you explicitly disable this, e.g., -DskipTests=true and other skippers. -Dmaven.site.lifecycle.skip?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I could agree. But this is not skipping it, it is like "pretending is not there" (filter it out, remove it from default ones).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just maven.site.lifecycle.disabled ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I could agree. But this is not skipping it, it is like "pretending is not there" (filter it out, remove it from default ones).

Yes, skipping is wrong. I noticed that after reflection.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just maven.site.lifecycle.disabled ?

maven.lifecycle.site.disabled if we talk about a properties tree.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure what tree you mean, but I am more to group properties by feature.

@cstamas cstamas merged commit eabc29d into apache:maven-3.10.x Apr 21, 2026
18 checks passed
@cstamas cstamas deleted the maven-3.10.x-site-lifecycle-disable branch April 21, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to disable maven-site-plugin

3 participants