Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d54fa76a7946d213458fd37ac4c5046b0ca388a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*******************************************************************************
 * Copyright (c) 2008-2010 Sonatype, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *      Sonatype, Inc. - initial API and implementation
 *******************************************************************************/

package org.eclipse.m2e.core.internal.project.registry;

import java.util.List;

import javax.inject.Singleton;

import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.graph.DependencyNode;
import org.eclipse.aether.repository.RemoteRepository;

import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.PluginResolutionException;
import org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver;


@Singleton
public class EclipsePluginDependenciesResolver extends DefaultPluginDependenciesResolver {

  /*
   * Plugin realms are cached and there is currently no way to purge cached
   * realms due to http://jira.codehaus.org/browse/MNG-4194.
   * 
   * Workspace plugins cannot be cached, so we disable this until MNG-4194 is fixed.
   * 
   * Corresponding m2e JIRA https://issues.sonatype.org/browse/MNGECLIPSE-1448
   */

  @Override
  public Artifact resolve(Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session)
      throws PluginResolutionException {
    boolean disabled = EclipseWorkspaceArtifactRepository.isDisabled();
    EclipseWorkspaceArtifactRepository.setDisabled(true);
    try {
      return super.resolve(plugin, repositories, session);
    } finally {
      EclipseWorkspaceArtifactRepository.setDisabled(disabled);
    }
  }

  @Override
  public DependencyNode resolve(Plugin plugin, Artifact pluginArtifact, DependencyFilter dependencyFilter,
      List<RemoteRepository> repositories, RepositorySystemSession session) throws PluginResolutionException {
    boolean disabled = EclipseWorkspaceArtifactRepository.isDisabled();
    EclipseWorkspaceArtifactRepository.setDisabled(true);
    try {
      return super.resolve(plugin, pluginArtifact, dependencyFilter, repositories, session);
    } finally {
      EclipseWorkspaceArtifactRepository.setDisabled(disabled);
    }
  }

}

Back to the top