You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2026/04/02 20:30:19 UTC
(maven-site-plugin) branch bugfix/configure-wagon-3.x created (now 17933957)
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a change to branch bugfix/configure-wagon-3.x
in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git
at 17933957 Configure Wagon from settings.xml (#1233)
This branch includes the following new commits:
new 17933957 Configure Wagon from settings.xml (#1233)
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-site-plugin) 01/01: Configure Wagon from settings.xml (#1233)
Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch bugfix/configure-wagon-3.x
in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git
commit 1793395795b1848c02d5aa7d74de34f0526e50ab
Author: Konrad Windszus <kw...@apache.org>
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 9f1d3eb8..36eeb580 100644
--- a/pom.xml
+++ b/pom.xml
@@ -271,6 +271,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 f280cdd0..f3f4e017 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;
}