Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid touching old plexus anymore #214

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,9 @@ under the License.

<!-- Plexus -->
<dependency>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-inject-plexus</artifactId>
<version>1.4.2</version>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
<version>0.9.0.M3</version>
<scope>provided</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.net.URL;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import org.apache.maven.doxia.site.inheritance.URIPathDescriptor;
import org.apache.maven.doxia.tools.SiteTool;
Expand Down Expand Up @@ -53,8 +54,6 @@
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.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;

/**
* Abstract base class for deploy mojos.
Expand Down Expand Up @@ -124,7 +123,7 @@ public abstract class AbstractDeployMojo extends AbstractSiteMojo {
private Site deploySite;

@Component
private PlexusContainer container;
private Map<String, Wagon> wagons;

@Component
SettingsDecrypter settingsDecrypter;
Expand Down Expand Up @@ -277,16 +276,15 @@ private Wagon getWagon(final Repository repository) throws MojoExecutionExceptio
if (protocol == null) {
throw new MojoExecutionException("Unspecified protocol");
}
try {
Wagon wagon = container.lookup(Wagon.class, protocol.toLowerCase(Locale.ROOT));
if (!wagon.supportsDirectoryCopy()) {
throw new MojoExecutionException(
"Wagon protocol '" + repository.getProtocol() + "' doesn't support directory copying");
}
return wagon;
} catch (ComponentLookupException e) {
throw new MojoExecutionException("Cannot find wagon which supports the requested protocol: " + protocol, e);
Wagon wagon = wagons.get(protocol.toLowerCase(Locale.ROOT));
if (wagon == null) {
throw new MojoExecutionException("Cannot find wagon which supports the requested protocol: " + protocol);
}
if (!wagon.supportsDirectoryCopy()) {
throw new MojoExecutionException(
"Wagon protocol '" + repository.getProtocol() + "' doesn't support directory copying");
}
return wagon;
}

public AuthenticationInfo getAuthenticationInfo(String id) {
Expand Down Expand Up @@ -558,7 +556,7 @@ private static String encodeURI(final String uriString) {
uri.append(c);
} else {
uri.append('%');
uri.append(Integer.toHexString((int) c));
uri.append(Integer.toHexString(c));
}
}
return uri.toString();
Expand Down