gnodet-bot commented on code in PR #13546:
URL: https://github.com/apache/maven/pull/13546#discussion_r4301525222


##########
its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh11759SiteLifecycleDisabledTest.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.io.File;

Review Comment:
   ⚠️ **Wrong import** — `extractResources()` returns `java.nio.file.Path`, not 
`java.io.File`. Replace this import.
   
   ```suggestion
   import java.nio.file.Path;
   ```



##########
api/maven-api-core/src/main/java/org/apache/maven/api/Constants.java:
##########
@@ -880,5 +880,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).
+     *

Review Comment:
   ⚠️ **Wrong `@since` version** — this constant is new in this PR which 
targets `master` (4.1.0). Compare with `MAVEN_TEMPFILE_KEEP` on `master` which 
also carries `@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,62 @@
+/*
+ * 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.io.File;
+
+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 {
+
+    MavenITgh11759SiteLifecycleDisabledTest() {
+        super("[4.0.0-rc-3,)");

Review Comment:
   ❌ **Compile error** — `AbstractMavenIntegrationTestCase` has no `String` 
constructor. The version filter was removed in the NIO2 migration; the 
framework now derives it from the test project's POM version range. Remove the 
`super(...)` call entirely.
   
   ```suggestion
           super();
   ```



##########
its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh11759SiteLifecycleDisabledTest.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.io.File;
+
+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 {
+
+    MavenITgh11759SiteLifecycleDisabledTest() {
+        super("[4.0.0-rc-3,)");
+    }
+
+    /**
+     * 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 {
+        File testDir = extractResources("/gh-11759-site-lifecycle-disabled");

Review Comment:
   ❌ **Compile error** — `extractResources()` returns `Path`, not `File`. Also, 
`newVerifier()` accepts a `String` or `Path`, so call `.toString()` or use the 
`Path` overload.
   
   ```suggestion
           Path testDir = extractResources("/gh-11759-site-lifecycle-disabled");
   ```



-- 
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]

Reply via email to