本文整理汇总了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");
}
}
示例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);
}
}
}
示例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);
}
示例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;
}
}
示例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;
}
示例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();
}
}
}
示例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());
}
示例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);
}
示例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);
}
}
}