You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/08/16 20:39:35 UTC

(maven-doxia-sitetools) branch honour-offline-in-sitetool-test created (now db232aa)

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a change to branch honour-offline-in-sitetool-test
in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git


      at db232aa  Let an offline build skip the tests that need a repository

This branch includes the following new commits:

     new db232aa  Let an offline build skip the tests that need a repository

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(maven-doxia-sitetools) 01/01: Let an offline build skip the tests that need a repository

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch honour-offline-in-sitetool-test
in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git

commit db232aa2a6c103b36cf0d7c028f68a955cb80d0f
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun Aug 16 22:39:24 2026 +0200

    Let an offline build skip the tests that need a repository
    
    SiteToolTest resolves the Fluido skin and parent site descriptors from Central.
    It assembles its own RepositorySystemSession, so Maven's offline setting never
    reaches it: running mvn -o still went to the network and still populated
    target/local-repo. An offline build therefore could not pass.
    
    The build now hands the setting to the test JVM and the class stands aside when
    it is set. This goes through argLine rather than systemPropertyVariables,
    because that map takes Strings and settings.offline interpolates as a Boolean.
    
    Verified: online, 11 tests run and none are skipped; with -o, all 11 skip and
    nothing is written to target/local-repo
---
 doxia-integration-tools/pom.xml                           | 15 +++++++++++++++
 .../java/org/apache/maven/doxia/tools/SiteToolTest.java   | 14 ++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/doxia-integration-tools/pom.xml b/doxia-integration-tools/pom.xml
index b195b62..41f5c52 100644
--- a/doxia-integration-tools/pom.xml
+++ b/doxia-integration-tools/pom.xml
@@ -167,6 +167,21 @@
     </dependency>
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <!-- SiteToolTest builds its own repository session, which never sees this otherwise.
+               Passed on the command line because systemPropertyVariables takes Strings only, and
+               settings.offline interpolates as a Boolean. -->
+          <argLine>-Ddoxia.test.offline=${settings.offline}</argLine>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
   <reporting>
     <plugins>
       <plugin>
diff --git a/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java b/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
index f33b019..de8de1d 100644
--- a/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
+++ b/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
@@ -51,6 +51,7 @@ import org.eclipse.aether.DefaultRepositorySystemSession;
 import org.eclipse.aether.RepositorySystemSession;
 import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
 import org.eclipse.aether.repository.LocalRepository;
+import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
 import static org.codehaus.plexus.testing.PlexusExtension.getTestFile;
@@ -61,6 +62,7 @@ import static org.junit.jupiter.api.Assertions.assertNotSame;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
 
 /**
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
@@ -72,6 +74,18 @@ class SiteToolTest {
     @Inject
     private DefaultSiteTool tool;
 
+    /**
+     * These tests resolve the skin and parent site descriptors from Central. The session below is
+     * built by hand, so it never sees Maven's own offline setting; the build passes it in as a system
+     * property and the tests stand aside when it is set.
+     */
+    @BeforeEach
+    void requireNetwork() {
+        assumeFalse(
+                Boolean.getBoolean("doxia.test.offline"),
+                "resolves the skin and site descriptors from a remote repository");
+    }
+
     /**
      * @return the local repo directory.
      *