当前位置: 首页>>代码示例>>Java>>正文


Java JavaScopes.PROVIDED属性代码示例

本文整理汇总了Java中org.eclipse.aether.util.artifact.JavaScopes.PROVIDED属性的典型用法代码示例。如果您正苦于以下问题:Java JavaScopes.PROVIDED属性的具体用法?Java JavaScopes.PROVIDED怎么用?Java JavaScopes.PROVIDED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.aether.util.artifact.JavaScopes的用法示例。


在下文中一共展示了JavaScopes.PROVIDED属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newSession

/**
 * Set up repository session for maven.
 * 
 * @param system
 *          the repository system
 * @param localDownloadDir
 *          the directory where to put the downloaded artifacts
 * @return the configured repository session
 */
private RepositorySystemSession newSession(RepositorySystem system, final String localDownloadDir) {
  DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();

  LocalRepository localRepo = new LocalRepository(localDownloadDir);
  session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));

  DependencySelector depFilter =
      new AndDependencySelector(
      new ScopeDependencySelector(JavaScopes.PROVIDED),
      new OptionalDependencySelector(),
      new ExclusionDependencySelector()
  );
  session.setDependencySelector(depFilter);

  return session;
}
 
开发者ID:Gemba,项目名称:mvn-dd,代码行数:25,代码来源:RepositorySystemHelper.java

示例2: isExported

/**
 * @param scope the scope to be tested upon
 * @return <code>true</code> if the scope indicates an exported dependency
 */
public static boolean isExported(String scope)
{
   String artifactScope = Strings.isNullOrEmpty(scope) ? JavaScopes.COMPILE : scope;
   switch (artifactScope)
   {
   case JavaScopes.COMPILE:
   case JavaScopes.RUNTIME:
      return true;
   case JavaScopes.PROVIDED:
   default:
      return false;
   }
}
 
开发者ID:forge,项目名称:furnace,代码行数:17,代码来源:MavenAddonDependencyResolver.java

示例3: execute

@Override
public void execute(DependencyResolveDetails dependencyResolveDetails) {
    String group = dependencyResolveDetails.getTarget().getGroup();
    String name = dependencyResolveDetails.getTarget().getName();
    if (aetherPlugin.getVersionMap().containsKey(group) && aetherPlugin.getVersionMap().get(group).containsKey(name)) {
        if (dependencyResolveDetails.getRequested().getVersion().equals(dependencyResolveDetails.getTarget().getVersion())) {
            dependencyResolveDetails.useVersion(aetherPlugin.getVersionMap().get(group).get(name));
        }
    } else {
        RepositorySystem system = setupRepositorySystem();
        RepositorySystemSession session = setupSession(project, system);
        List<RemoteRepository> remoteRepositories = new ArrayList<>();
        for (ArtifactRepository artifactRepository : project.getRepositories()) {
            if (artifactRepository instanceof MavenArtifactRepository) {
                MavenArtifactRepository mavenArtifactRepository = (MavenArtifactRepository) artifactRepository;
                remoteRepositories.add(new RemoteRepository.Builder(mavenArtifactRepository.getName(), "default", mavenArtifactRepository.getUrl().toString()).build());
            }
        }
        Artifact artifact = new DefaultArtifact(dependencyResolveDetails.getTarget().getGroup()
                + ":" + dependencyResolveDetails.getTarget().getName()
                + ":" + dependencyResolveDetails.getTarget().getVersion());

        CollectRequest collectRequest = new CollectRequest();
        String scope;
        if (configuration.getName().contains("test")) {
            scope = JavaScopes.TEST;
        } else if (configuration.getName().contains("runtime")) {
            scope = JavaScopes.RUNTIME;
        } else if (configuration.getName().equals("providedCompile")
                || configuration.getName().equals("compileOnly")) {
            scope = JavaScopes.PROVIDED;
        } else
            scope = JavaScopes.COMPILE;
        collectRequest.setRoot(new Dependency(artifact, scope));
        collectRequest.setRepositories(remoteRepositories);

        try {
            CollectResult collectResult = system.collectDependencies(session, collectRequest);
            processDependencyNode(collectResult.getRoot());
        } catch (DependencyCollectionException e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:SetoKaiba,项目名称:aether-gradle-plugin,代码行数:44,代码来源:VersionResolverDependencyResolveDetails.java


注:本文中的org.eclipse.aether.util.artifact.JavaScopes.PROVIDED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。