Skip to content

Commit

Permalink
Fix #46
Browse files Browse the repository at this point in the history
Fix the issue 46 - #46

* migrate to the Maven-API 3.1.0
* remote Aether dependency - unfortunately, the code using Aether cannot work anymore. username and password cannot be retrieved from the Authentication object anymore. We still rely on the settings.xml
* update github-core version in the download plugin

Signed-off-by: Clement Escoffier <clement.escoffier@gmail.com>
  • Loading branch information
cescoffier committed Aug 11, 2013
1 parent 5eada8d commit ec57932
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 23 deletions.
4 changes: 2 additions & 2 deletions github-core/pom.xml
Expand Up @@ -125,13 +125,13 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.0</version>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.0</version>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Expand Up @@ -36,9 +36,10 @@
import org.apache.maven.settings.Settings;
import org.eclipse.egit.github.core.RepositoryId;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.Authentication;
import org.sonatype.aether.repository.RemoteRepository;

import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.Authentication;
import org.eclipse.aether.repository.RemoteRepository;

/**
* Base GitHub Mojo class to be extended.
Expand Down Expand Up @@ -248,21 +249,24 @@ protected boolean configureServerCredentials(final GitHubClient client,
String serverUsername = null;
String serverPassword = null;

if (session != null) {
RepositorySystemSession systemSession = session
.getRepositorySession();
if (systemSession != null) {
Authentication authInfo = systemSession
.getAuthenticationSelector().getAuthentication(
new RemoteRepository().setId(serverId));
if (authInfo != null) {
serverUsername = authInfo.getUsername();
serverPassword = authInfo.getPassword();
}
}
}
// Maven 3.1.0 - It's now impossible to retrieve the username and password from the remote repository.

if (StringUtils.isEmpty(serverPassword)) {
// if (session != null) {
// RepositorySystemSession systemSession = session
// .getRepositorySession();
// if (systemSession != null) {
// RemoteRepository.Builder builder = new RemoteRepository.Builder(serverId, "", "");
// Authentication authInfo = systemSession.getAuthenticationSelector().getAuthentication
// (builder.build());
// if (authInfo != null) {
// serverUsername = authInfo.getUsername();
// serverPassword = authInfo.getPassword();
// }
// }
// }

// Always true.
// if (StringUtils.isEmpty(serverPassword)) {
Server server = getServer(settings, serverId);
if (server == null)
throw new MojoExecutionException(MessageFormat.format(
Expand All @@ -274,7 +278,7 @@ protected boolean configureServerCredentials(final GitHubClient client,

serverUsername = server.getUsername();
serverPassword = server.getPassword();
}
// }

if (!StringUtils.isEmpty(serverUsername, serverPassword)) {
if (isDebug())
Expand Down
6 changes: 3 additions & 3 deletions github-site-plugin/pom.xml
Expand Up @@ -199,13 +199,13 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.0</version>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.0</version>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -216,7 +216,7 @@
<dependency>
<groupId>com.github.github</groupId>
<artifactId>github-maven-core</artifactId>
<version>0.6</version>
<version>0.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down

0 comments on commit ec57932

Please sign in to comment.