-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed an issue involving ProjectHelper and secure repositories.
This ensures that the Furnace build succeeds when a settings.xml file with passwords for mirrors or secured repositories used in the tests, is present in the Maven home directory.
- Loading branch information
1 parent
d47bb7e
commit 4316782
Showing
2 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
...llian/core/src/main/java/org/jboss/forge/arquillian/maven/LazyAuthenticationSelector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2013 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.jboss.forge.arquillian.maven; | ||
|
||
import org.eclipse.aether.repository.Authentication; | ||
import org.eclipse.aether.repository.AuthenticationSelector; | ||
import org.eclipse.aether.repository.RemoteRepository; | ||
import org.eclipse.aether.util.repository.DefaultAuthenticationSelector; | ||
import org.eclipse.aether.util.repository.DefaultMirrorSelector; | ||
|
||
/** | ||
* An {@link AuthenticationSelector} that resolves the Authentication info lazily at runtime. This selector determines | ||
* whether a remote repository is mirrored and then returns the authentication info for the mirror. If no mirror exists, | ||
* the authentication info for the remote repository is returned. | ||
*/ | ||
final class LazyAuthenticationSelector implements AuthenticationSelector | ||
{ | ||
private final DefaultMirrorSelector mirrorSelector; | ||
private DefaultAuthenticationSelector defaultAuthSelector; | ||
|
||
LazyAuthenticationSelector(DefaultMirrorSelector mirrorSelector) | ||
{ | ||
this.mirrorSelector = mirrorSelector; | ||
this.defaultAuthSelector = new DefaultAuthenticationSelector(); | ||
} | ||
|
||
@Override | ||
public Authentication getAuthentication(RemoteRepository repository) | ||
{ | ||
RemoteRepository mirror = mirrorSelector.getMirror(repository); | ||
if (mirror != null) | ||
{ | ||
return defaultAuthSelector.getAuthentication(mirror); | ||
} | ||
return defaultAuthSelector.getAuthentication(repository); | ||
} | ||
|
||
public void add(String id, Authentication authentication) | ||
{ | ||
defaultAuthSelector.add(id, authentication); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters