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

slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-scm.git


The following commit(s) were added to refs/heads/master by this push:
     new fb1d1e5ee [SCM-798] Add branchBase parameter for custom svn layouts
fb1d1e5ee is described below

commit fb1d1e5ee1fcb7fa53aab788a4183d384f56f939
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Tue Nov 17 02:04:36 2026 +0100

    [SCM-798] Add branchBase parameter for custom svn layouts
    
    Fixes #1015
---
 .../apache/maven/scm/plugin/AbstractScmMojo.java   | 17 +++++++++
 .../maven/scm/plugin/BranchBaseMojoTest.java       | 41 ++++++++++++++++++++++
 .../resources/mojos/branch-base/branchBase.xml     | 33 +++++++++++++++++
 3 files changed, 91 insertions(+)

diff --git 
a/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/AbstractScmMojo.java
 
b/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/AbstractScmMojo.java
index c3d7c516d..7f6f25d63 100644
--- 
a/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/AbstractScmMojo.java
+++ 
b/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/AbstractScmMojo.java
@@ -148,6 +148,16 @@ public abstract class AbstractScmMojo extends AbstractMojo 
{
     @Parameter(property = "tagBase")
     private String tagBase;
 
+    /**
+     * The URL of the branch's base directory (used by svn protocol). It is not
+     * necessary to set it if you use the standard svn layout
+     * (branches/tags/trunk).
+     *
+     * @since 2.3.0
+     */
+    @Parameter(property = "branchBase")
+    private String branchBase;
+
     /**
      * Comma separated list of includes file pattern.
      */
@@ -363,6 +373,13 @@ public ScmRepository getScmRepository() throws 
ScmException {
                 svnRepo.setTagBase(tagBase);
             }
 
+            if (!(branchBase == null || branchBase.isEmpty())
+                    && repository.getProvider().equals("svn")) {
+                SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) 
repository.getProviderRepository();
+
+                svnRepo.setBranchBase(branchBase);
+            }
+
             return repository;
         } catch (ScmRepositoryException e) {
             if (!e.getValidationMessages().isEmpty()) {
diff --git 
a/maven-scm-plugin/src/test/java/org/apache/maven/scm/plugin/BranchBaseMojoTest.java
 
b/maven-scm-plugin/src/test/java/org/apache/maven/scm/plugin/BranchBaseMojoTest.java
new file mode 100644
index 000000000..a7bdaa9c7
--- /dev/null
+++ 
b/maven-scm-plugin/src/test/java/org/apache/maven/scm/plugin/BranchBaseMojoTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.scm.plugin;
+
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoTest;
+import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
+import org.apache.maven.scm.repository.ScmRepository;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+@MojoTest
+class BranchBaseMojoTest {
+
+    @Test
+    @InjectMojo(goal = "branch", pom = 
"classpath:/mojos/branch-base/branchBase.xml")
+    void testBranchBaseAndTagBaseAreApplied(BranchMojo mojo) throws Exception {
+        ScmRepository repository = mojo.getScmRepository();
+        SvnScmProviderRepository svnRepository = (SvnScmProviderRepository) 
repository.getProviderRepository();
+
+        assertEquals("http://svn.example.org/repos/project/stable";, 
svnRepository.getBranchBase());
+        assertEquals("http://svn.example.org/repos/project/releases";, 
svnRepository.getTagBase());
+    }
+}
diff --git 
a/maven-scm-plugin/src/test/resources/mojos/branch-base/branchBase.xml 
b/maven-scm-plugin/src/test/resources/mojos/branch-base/branchBase.xml
new file mode 100644
index 000000000..34f2c7553
--- /dev/null
+++ b/maven-scm-plugin/src/test/resources/mojos/branch-base/branchBase.xml
@@ -0,0 +1,33 @@
+<!--
+  ~ 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.
+  -->
+
+<project>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-scm-plugin</artifactId>
+        <configuration>
+          
<connectionUrl>scm:svn:http://svn.example.org/repos/project/trunk</connectionUrl>
+          <tagBase>http://svn.example.org/repos/project/releases</tagBase>
+          <branchBase>http://svn.example.org/repos/project/stable</branchBase>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Reply via email to