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


Java JavaScopes.COMPILE属性代码示例

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


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

示例1: addDependencyManagement

public void addDependencyManagement(DependencyManagement dependencyManagement) {
	for (org.springframework.boot.cli.compiler.dependencies.Dependency dependency : dependencyManagement
			.getDependencies()) {
		List<Exclusion> aetherExclusions = new ArrayList<Exclusion>();
		for (org.springframework.boot.cli.compiler.dependencies.Dependency.Exclusion exclusion : dependency
				.getExclusions()) {
			aetherExclusions.add(new Exclusion(exclusion.getGroupId(),
					exclusion.getArtifactId(), "*", "*"));
		}
		Dependency aetherDependency = new Dependency(
				new DefaultArtifact(dependency.getGroupId(),
						dependency.getArtifactId(), "jar", dependency.getVersion()),
				JavaScopes.COMPILE, false, aetherExclusions);
		this.managedDependencies.add(0, aetherDependency);
		this.managedDependencyByGroupAndArtifact.put(getIdentifier(aetherDependency),
				aetherDependency);
	}
	this.dependencyManagement = this.dependencyManagement == null
			? dependencyManagement
			: new CompositeDependencyManagement(dependencyManagement,
					this.dependencyManagement);
	this.artifactCoordinatesResolver = new DependencyManagementArtifactCoordinatesResolver(
			this.dependencyManagement);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:24,代码来源:DependencyResolutionContext.java

示例2: downloadDependencyTree

/**
 * Resolves and downloads an artifact with its dependencies.
 * 
 * @param artifact
 *          artifact to resolve
 * @param javadoc
 *          <code>true</code> if javadoc attachment should be retrieved too
 * @param sources
 *          <code>true</code> if sources attachment should be retrieved too
 * @throws DependencyCollectionException
 *           if the dependency graph could not be properly assembled
 * @throws DependencyResolutionException
 *           if a dependency is not resolvable
 */
public void downloadDependencyTree(DefaultArtifact artifact, boolean javadoc, boolean sources)
    throws DependencyCollectionException, DependencyResolutionException {
  log.info("Resolving: {} with these dependencies ...", artifact.toString());

  Dependency dependency = new Dependency(artifact, JavaScopes.COMPILE);

  DependencyNode jarNode = repoSystemHelper.collectDependencies(dependency);

  DependencyFilter classpathFilter = DependencyFilterUtils.classpathFilter(JavaScopes.TEST);
  jarNode.accept(new TreeDependencyVisitor(new FilteringDependencyVisitor(new DependencyGraphPrinter(), classpathFilter)));

  DependencyRequest dependencyRequest = new DependencyRequest(jarNode, classpathFilter);
  DependencyResult dependencyResult = repoSystemHelper.resolveDependencies(dependencyRequest);

  if (javadoc) {
    downloadAttachments(dependencyResult, "javadoc");
  }

  if (sources) {
    downloadAttachments(dependencyResult, "sources");
  }
}
 
开发者ID:Gemba,项目名称:mvn-dd,代码行数:36,代码来源:DependencyResolver.java

示例3: downloadAttachments

/**
 * Downloads additional artifacts like javadoc or sources.
 * 
 * @param depResult
 *          a set of resolved dependencies
 * @param attachment
 *          type of attachment. Either "javadoc" or "sources"
 * @throws DependencyCollectionException
 */
private void downloadAttachments(DependencyResult depResult, final String attachment) throws DependencyCollectionException {

  for (ArtifactResult artifactResult : depResult.getArtifactResults()) {

    final Artifact artifact = artifactResult.getArtifact();
    final String artifactId = artifact.getArtifactId();
    final String groupId = artifact.getGroupId();
    final String extension = artifact.getExtension();
    final String version = artifact.getVersion();

    log.info("Resolving {} for {}", attachment, artifact);

    try {
      DefaultArtifact extraArtifact = new DefaultArtifact(groupId, artifactId, attachment, extension, version);
      Dependency attachedDependency = new Dependency(extraArtifact, JavaScopes.COMPILE);

      DependencyNode attachmentNode = repoSystemHelper.collectDependencies(attachedDependency);
      DependencyRequest javadocDependencyRequest = new DependencyRequest(attachmentNode, null);

      repoSystemHelper.resolveDependencies(javadocDependencyRequest);
    } catch (DependencyResolutionException de) {
      log.warn("No {} found for {}", attachment, artifact);
    }
  }
}
 
开发者ID:Gemba,项目名称:mvn-dd,代码行数:34,代码来源:DependencyResolver.java

示例4: fetch

private Page<Artifact, Artifact> fetch(Artifact artifact)
		throws SettingsBuildingException, DependencyResolutionException, DependencyCollectionException {
	ScopeDependencySelector dependencySelector = new ScopeDependencySelector(
			Collections.singleton(JavaScopes.COMPILE), Collections.emptySet());
	Dependency task = new Dependency(new Maven());
	Processor processor = new Processor(task, true, true, JavaScopes.COMPILE, dependencySelector, false);
	return processor.process(artifact);
}
 
开发者ID:maenu,项目名称:kowalski,代码行数:8,代码来源:ApplicationTest.java

示例5: createDependency

private Dependency createDependency(Map<?, ?> dependencyMap,
		List<Exclusion> exclusions) {
	Artifact artifact = createArtifact(dependencyMap);
	if (isTransitive(dependencyMap)) {
		return new Dependency(artifact, JavaScopes.COMPILE, false, exclusions);
	}
	return new Dependency(artifact, JavaScopes.COMPILE, null, WILDCARD_EXCLUSION);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:AetherGrapeEngine.java

示例6: 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

示例7: getDependencies

private List<Dependency> getDependencies(JsonArray webjars) {
	List<Dependency> dependencies = new ArrayList<>();

	for (int i = 0; i < webjars.size(); i++) {
		String artifactGav = webjars.get(i);

		Artifact artifact = new DefaultArtifact(artifactGav);
		Dependency dependency = new Dependency(artifact, JavaScopes.COMPILE);
		dependencies.add(dependency);
	}

	return dependencies;
}
 
开发者ID:ylemoigne,项目名称:vertx-mod-webjar,代码行数:13,代码来源:WebjarPullerVerticle.java

示例8: validateBomDependencies

private void validateBomDependencies(ValidatorContext ctx, Model bom) {
    Artifact bomArtifact = new DefaultArtifact(bom.getGroupId(), bom.getArtifactId(), bom.getPackaging(), bom.getVersion());
    Dependency bomDependency = new Dependency(bomArtifact, JavaScopes.COMPILE);
    for (org.apache.maven.model.Dependency dependency : bom.getDependencyManagement().getDependencies()) {
        validateBomDependency(ctx, bom, bomDependency, validatorSupport.convert(dependency));
    }
}
 
开发者ID:release-engineering,项目名称:redhat-repository-validator,代码行数:7,代码来源:BomDependencyNotFoundValidator.java

示例9: 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

示例10: createDirectDependencyList

private List<Dependency> createDirectDependencyList(List<String> artifactCoords) {
  Function<String, Dependency> coordinateToDependencyNode =
      a -> new Dependency(new DefaultArtifact(a), JavaScopes.COMPILE);
  return artifactCoords.stream().map(coordinateToDependencyNode).collect(toList());
}
 
开发者ID:bazelbuild,项目名称:migration-tooling,代码行数:5,代码来源:ArtifactResolver.java

示例11: dependencyNode

/** Helper for creating a dependency node */
private DependencyNode dependencyNode(String coordinate) {
  Dependency dependency = new Dependency(new DefaultArtifact(coordinate), JavaScopes.COMPILE);
  return new DefaultDependencyNode(dependency);
}
 
开发者ID:bazelbuild,项目名称:migration-tooling,代码行数:5,代码来源:GraphSerializerTest.java

示例12: addDep

private void addDep(String groupId, String artifactId, String classifier, String version) throws MojoExecutionException {
	getLog().debug("addDep "+groupId+":"+artifactId);
	org.eclipse.aether.artifact.Artifact aetherArtifact = new DefaultArtifact(
			groupId,
			artifactId,
			classifier,
			"jar",
			version);

	final org.eclipse.aether.graph.Dependency dependency = new org.eclipse.aether.graph.Dependency( aetherArtifact, JavaScopes.COMPILE );
	CollectRequest collectRequest = new CollectRequest();
	collectRequest.setRepositories(this.repositories);
	collectRequest.setRoot( dependency );

	DependencyRequest dependencyRequest = new DependencyRequest();
	dependencyRequest.setCollectRequest(collectRequest);
	dependencyRequest.setFilter(new DependencyFilter(){
		@Override
		public boolean accept(DependencyNode dep, List<DependencyNode> parents) {
			return dep.getArtifact().getClassifier() == null;
		}
	});

	DependencyResult dependencyResult;
	try {
		dependencyResult = this.repoSystem.resolveDependencies(this.repoSession, dependencyRequest);
	} catch (DependencyResolutionException e) {
		throw new MojoExecutionException( "Artifact could not be resolved.", e );
	}

	getLog().debug("Got results: "+dependencyResult.getArtifactResults());
	for(ArtifactResult result : dependencyResult.getArtifactResults()){
		getLog().debug("Got result: "+result);
		File file = result.getArtifact().getFile();
		if( file == null || ! file.exists()) {
			getLog().warn( "Artifact has no attached file. Its content will not be copied in the target model directory." );
		}else if(file.isDirectory()){
			getLog().warn( "Artifact is a folder. Its content will not be copied in the target model directory." );
		}else{
			exportDependency(result.getArtifact().getVersion(), file);
		}
	}
}
 
开发者ID:ceylon,项目名称:ceylon-maven-plugin,代码行数:43,代码来源:AbstractCeylonMojo.java


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