This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 6c97398f Configure Wagon from settings.xml (#1233)
6c97398f is described below
commit 6c97398f4a56f4e0db5b415def725926ddd84f85
Author: Konrad Windszus <[email protected]>
AuthorDate: Sun Mar 8 19:34:34 2026 +0100
Configure Wagon from settings.xml (#1233)
This regressed with
https://github.com/apache/maven-site-plugin/commit/e414d23496e5bd3949774f2f8267e93eebf69f10
This closes #1217
---
pom.xml | 8 +++++++
.../plugins/site/deploy/AbstractDeployMojo.java | 27 ++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/pom.xml b/pom.xml
index 8b8f5218..ec783105 100644
--- a/pom.xml
+++ b/pom.xml
@@ -284,6 +284,14 @@ under the License.
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
+ <!-- reusing component to configure Wagon -->
+ <dependency>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-transport-wagon</artifactId>
+ <version>1.4.1</version>
+ <!-- version shipping with Maven 3.6.3-->
+ <scope>compile</scope>
+ </dependency>
<dependency>
<groupId>org.apache.maven</groupId>
diff --git
a/src/main/java/org/apache/maven/plugins/site/deploy/AbstractDeployMojo.java
b/src/main/java/org/apache/maven/plugins/site/deploy/AbstractDeployMojo.java
index 7419cb01..984cb364 100644
--- a/src/main/java/org/apache/maven/plugins/site/deploy/AbstractDeployMojo.java
+++ b/src/main/java/org/apache/maven/plugins/site/deploy/AbstractDeployMojo.java
@@ -55,6 +55,9 @@ import
org.apache.maven.wagon.authorization.AuthorizationException;
import org.apache.maven.wagon.observers.Debug;
import org.apache.maven.wagon.proxy.ProxyInfo;
import org.apache.maven.wagon.repository.Repository;
+import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.eclipse.aether.transport.wagon.WagonConfigurator;
/**
* Abstract base class for deploy mojos.
@@ -129,6 +132,8 @@ public abstract class AbstractDeployMojo extends
AbstractSiteMojo {
@Inject
SettingsDecrypter settingsDecrypter;
+ @Inject
+ private WagonConfigurator wagonConfigurator;
/**
* {@inheritDoc}
*/
@@ -285,6 +290,28 @@ public abstract class AbstractDeployMojo extends
AbstractSiteMojo {
throw new MojoExecutionException(
"Wagon protocol '" + repository.getProtocol() + "' doesn't
support directory copying");
}
+ // retrieve relevant settings
+ Server server = settings.getServer(repository.getId());
+ // taken over from
+ //
https://github.com/apache/maven/blob/18a52647884dcc822eb04bf5a3265a21dc83256c/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java#L242
+ if (server != null && server.getConfiguration() != null) {
+ Xpp3Dom dom = (Xpp3Dom) server.getConfiguration();
+ for (int i = dom.getChildCount() - 1; i >= 0; i--) {
+ Xpp3Dom child = dom.getChild(i);
+ if ("wagonProvider".equals(child.getName())) {
+ dom.removeChild(i);
+ }
+ }
+ XmlPlexusConfiguration config = new XmlPlexusConfiguration(dom);
+ try {
+ // use Wagon configurator from Resolver
+ wagonConfigurator.configure(wagon, config);
+ } catch (Exception e) {
+ throw new MojoExecutionException(
+ "Error configuring wagon with server configuration for
server id '" + repository.getId() + "'",
+ e);
+ }
+ }
return wagon;
}