gnodet-bot commented on code in PR #13546:
URL: https://github.com/apache/maven/pull/13546#discussion_r4316555989
##########
api/maven-api-core/src/main/java/org/apache/maven/api/Constants.java:
##########
@@ -888,5 +888,22 @@ public final class Constants {
@Config(type = "java.lang.Boolean", defaultValue = "false", source =
Config.Source.SYSTEM_PROPERTIES)
public static final String MAVEN_TEMPFILE_KEEP = "maven.tempfile.keep";
+ /**
+ * System property to disable the {@code site} lifecycle.
+ * When set to {@code true} via {@code
-Dmaven.site.lifecycle.disabled=true}, the {@code site}
+ * lifecycle is excluded from the default lifecycles, so Maven will not
resolve or bind the
+ * {@code maven-site-plugin} unless it is explicitly configured in the POM.
+ * This is a JVM system property only (read via {@link
Boolean#getBoolean(String)});
+ * it is not resolved through Maven's property mechanism (pom.xml,
profiles, settings.xml).
+ *
+ * @since 4.0.0
Review Comment:
⚠️ **Fifth cycle — same issue.** This constant is new in 4.1.0 (master is
`4.1.0-SNAPSHOT`). All surrounding constants use `@since 4.1.0` (see lines
792–886 in the file). Must be `@since 4.1.0`.
```suggestion
* @since 4.1.0
```
##########
its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh11759SiteLifecycleDisabledTest.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+package org.apache.maven.it;
+
+import java.nio.file.Path;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/**
+ * Integration test for <a
href="https://github.com/apache/maven/issues/11759">gh-11759</a>:
+ * verifies that setting {@code -Dmaven.site.lifecycle.disabled=true} via
{@code MAVEN_OPTS}
+ * removes the {@code site} lifecycle so that invoking the {@code site} phase
fails with
+ * "Unknown lifecycle phase".
+ */
+class MavenITgh11759SiteLifecycleDisabledTest extends
AbstractMavenIntegrationTestCase {
Review Comment:
⚠️ **`AbstractMavenIntegrationTestCase` has no default constructor** — only
`protected AbstractMavenIntegrationTestCase(String versionRangeStr, ...)`. This
class will not compile as-is. Review 4 flagged the missing `super(...)` call;
the fix removed it entirely instead of keeping it with the right version range.
```suggestion
class MavenITgh11759SiteLifecycleDisabledTest extends
AbstractMavenIntegrationTestCase {
MavenITgh11759SiteLifecycleDisabledTest() {
super("[4.0.0,)");
}
```
##########
its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh11759SiteLifecycleDisabledTest.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+package org.apache.maven.it;
+
+import java.nio.file.Path;
Review Comment:
⚠️ **Wrong import — `extractResources()` returns `java.io.File`, not
`java.nio.file.Path`.** The previous review said the type was wrong; the fix
went in the wrong direction. `newVerifier()` also takes `String`, not `Path`.
Replace with `java.io.File`.
```suggestion
import java.io.File;
```
##########
its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh11759SiteLifecycleDisabledTest.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+package org.apache.maven.it;
+
+import java.nio.file.Path;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/**
+ * Integration test for <a
href="https://github.com/apache/maven/issues/11759">gh-11759</a>:
+ * verifies that setting {@code -Dmaven.site.lifecycle.disabled=true} via
{@code MAVEN_OPTS}
+ * removes the {@code site} lifecycle so that invoking the {@code site} phase
fails with
+ * "Unknown lifecycle phase".
+ */
+class MavenITgh11759SiteLifecycleDisabledTest extends
AbstractMavenIntegrationTestCase {
+
+ /**
+ * Verifies that with {@code maven.site.lifecycle.disabled=true} the site
lifecycle
+ * is absent and invoking the {@code site} phase causes a build failure.
+ */
+ @Test
+ void testSiteLifecycleDisabledViaSystemProperty() throws Exception {
+ Path testDir = extractResources("/gh-11759-site-lifecycle-disabled");
+
+ Verifier verifier = newVerifier(testDir);
Review Comment:
⚠️ **Two compile errors here:** (1) `extractResources()` returns `File`, so
`Path testDir` won't compile. (2) `newVerifier()` takes `String`, not `Path` —
call `.getAbsolutePath()`. Conventional pattern used across the test suite:
```suggestion
File testDir = extractResources("/gh-11759-site-lifecycle-disabled");
Verifier verifier = newVerifier(testDir.getAbsolutePath());
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]