Search in sources :

Example 1 with WagonException

use of org.apache.maven.wagon.WagonException in project intellij-community by JetBrains.

the class Maven3ServerIndexFetcher method connect.

@Override
public void connect(String _ignoredContextId, String _ignoredUrl) throws IOException {
    ArtifactRepository artifactRepository = myRepositorySystem.createArtifactRepository(myOriginalRepositoryId, myOriginalRepositoryUrl, null, null, null);
    final ArtifactRepository mirrorRepository = myWagonManager.getMirrorRepository(artifactRepository);
    String mirrorUrl = mirrorRepository.getUrl();
    String indexUrl = mirrorUrl + (mirrorUrl.endsWith("/") ? "" : "/") + ".index";
    Repository repository = new Repository(myOriginalRepositoryId, indexUrl);
    try {
        myWagon = myWagonManager.getWagon(repository);
        myWagon.addTransferListener(myListener);
        myWagon.connect(repository, myWagonManager.getAuthenticationInfo(mirrorRepository.getId()), myWagonManager.getProxy(mirrorRepository.getProtocol()));
    } catch (AuthenticationException e) {
        IOException newEx = new IOException("Authentication exception connecting to " + repository);
        newEx.initCause(e);
        throw newEx;
    } catch (WagonException e) {
        IOException newEx = new IOException("Wagon exception connecting to " + repository);
        newEx.initCause(e);
        throw newEx;
    }
}
Also used : Repository(org.apache.maven.wagon.repository.Repository) ArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository) AuthenticationException(org.apache.maven.wagon.authentication.AuthenticationException) ArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository) IOException(java.io.IOException) WagonException(org.apache.maven.wagon.WagonException)

Example 2 with WagonException

use of org.apache.maven.wagon.WagonException in project intellij-community by JetBrains.

the class Maven2ServerIndexFetcher method connect.

public void connect(String _ignoredContextId, String _ignoredUrl) throws IOException {
    final ArtifactRepository mirrorRepository = myWagonManager.getMirrorRepository(new DefaultArtifactRepository(myOriginalRepositoryId, myOriginalRepositoryUrl, null));
    String mirrorUrl = mirrorRepository.getUrl();
    String indexUrl = mirrorUrl + (mirrorUrl.endsWith("/") ? "" : "/") + ".index";
    Repository repository = new Repository(myOriginalRepositoryId, indexUrl);
    try {
        myWagon = myWagonManager.getWagon(repository);
        myWagon.addTransferListener(myListener);
        myWagon.connect(repository, myWagonManager.getAuthenticationInfo(mirrorRepository.getId()), myWagonManager.getProxy(mirrorRepository.getProtocol()));
    } catch (AuthenticationException e) {
        IOException newEx = new IOException("Authentication exception connecting to " + repository);
        newEx.initCause(e);
        throw newEx;
    } catch (WagonException e) {
        IOException newEx = new IOException("Wagon exception connecting to " + repository);
        newEx.initCause(e);
        throw newEx;
    }
}
Also used : DefaultArtifactRepository(org.apache.maven.artifact.repository.DefaultArtifactRepository) Repository(org.apache.maven.wagon.repository.Repository) ArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository) AuthenticationException(org.apache.maven.wagon.authentication.AuthenticationException) DefaultArtifactRepository(org.apache.maven.artifact.repository.DefaultArtifactRepository) DefaultArtifactRepository(org.apache.maven.artifact.repository.DefaultArtifactRepository) ArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository) IOException(java.io.IOException) WagonException(org.apache.maven.wagon.WagonException)

Example 3 with WagonException

use of org.apache.maven.wagon.WagonException in project maven-plugins by apache.

the class CopyRepositoryMojo method execute.

public void execute() throws MojoExecutionException {
    try {
        Repository sourceRepository = new Repository(sourceRepositoryId, source);
        Repository targetRepository = new Repository(targetRepositoryId, target);
        copier.copy(sourceRepository, targetRepository, version);
    } catch (IOException e) {
        throw new MojoExecutionException("Error copying repository from " + source + " to " + target, e);
    } catch (WagonException e) {
        throw new MojoExecutionException("Error copying repository from " + source + " to " + target, e);
    }
}
Also used : Repository(org.apache.maven.wagon.repository.Repository) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) IOException(java.io.IOException) WagonException(org.apache.maven.wagon.WagonException)

Aggregations

IOException (java.io.IOException)3 WagonException (org.apache.maven.wagon.WagonException)3 Repository (org.apache.maven.wagon.repository.Repository)3 ArtifactRepository (org.apache.maven.artifact.repository.ArtifactRepository)2 AuthenticationException (org.apache.maven.wagon.authentication.AuthenticationException)2 DefaultArtifactRepository (org.apache.maven.artifact.repository.DefaultArtifactRepository)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1