本文整理汇总了Java中org.apache.maven.shared.dependency.tree.DependencyNode.getState方法的典型用法代码示例。如果您正苦于以下问题:Java DependencyNode.getState方法的具体用法?Java DependencyNode.getState怎么用?Java DependencyNode.getState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.shared.dependency.tree.DependencyNode
的用法示例。
在下文中一共展示了DependencyNode.getState方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateStateTipPart
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
@NbBundle.Messages({
"TIP_Included=Is included",
"TIP_Conflict=Is omitted for conflict, version used is {0}",
"TIP_Duplicate=Is omitted for duplicate with the same version",
"TIP_Cycle=Is omitted for cycle"
})
private static String calculateStateTipPart(DependencyNode node) {
int s = node.getState();
if (s == DependencyNode.INCLUDED) {
return Bundle.TIP_Included();
} else if (s == DependencyNode.OMITTED_FOR_CONFLICT) {
return Bundle.TIP_Conflict(node.getRelatedArtifact().getVersion());
} else if (s == DependencyNode.OMITTED_FOR_DUPLICATE) {
return Bundle.TIP_Duplicate();
} else if (s == DependencyNode.OMITTED_FOR_CYCLE) {
return Bundle.TIP_Cycle();
}
throw new IllegalStateException("illegal state:" + s);
}
示例2: addDependencyArtifacts
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
private void addDependencyArtifacts( Set<Artifact> collection, Set<?> classPathArtifacts, DependencyNode artifactNode )
{
if ( artifactNode.getState() == DependencyNode.INCLUDED )
{
Artifact artifact = artifactNode.getArtifact();
// don't use this artifact, because it can be unresolved
// find corresponding artifact in "classPathArtifacts" set
// (only if exists, if does not exist - we don't need it)
for ( Iterator<?> iter = classPathArtifacts.iterator(); iter.hasNext(); )
{
Artifact a = (Artifact) iter.next();
if ( areArtifactsEqual( artifact, a ) )
{
collection.add( a );
break;
}
}
List<?> childDependencyNodes = artifactNode.getChildren();
for ( Iterator<?> iter = childDependencyNodes.iterator(); iter.hasNext(); )
{
DependencyNode childNode = (DependencyNode) iter.next();
addDependencyArtifacts( collection, classPathArtifacts, childNode );
}
}
}
开发者ID:play1-maven-plugin,项目名称:play1-maven-plugin,代码行数:26,代码来源:AbstractDependencyProcessingPlayMojo.java
示例3: findArtifactNode
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
private DependencyNode findArtifactNode( Artifact artifact, DependencyNode findRootNode )
{
DependencyNode result = null;
if ( findRootNode.getState() == DependencyNode.INCLUDED )
{
if ( findRootNode.getArtifact().equals( artifact ) )
{
result = findRootNode;
}
else
{
List<?> childDependencyNodes = findRootNode.getChildren();
for ( Iterator<?> iter = childDependencyNodes.iterator(); iter.hasNext(); )
{
DependencyNode childNode = (DependencyNode) iter.next();
DependencyNode tmp = findArtifactNode( artifact, childNode );
if ( tmp != null )
{
result = tmp;
break;
}
}
}
}
return result;
}
开发者ID:play1-maven-plugin,项目名称:play1-maven-plugin,代码行数:27,代码来源:AbstractDependencyProcessingPlayMojo.java
示例4: visit
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
@Override public boolean visit(DependencyNode node) {
if (root == null) {
root = node;
}
if (node.getState() == DependencyNode.INCLUDED) {
ArtifactGraphNode grNode = scene.getGraphNodeRepresentant(node);
if (grNode == null) {
return false;
}
ArtifactWidget aw = (ArtifactWidget) scene.findWidget(grNode);
aw.hightlightScopes(scopes);
path.push(node);
return true;
} else {
return false;
}
}
示例5: visit
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
@Override public boolean visit(DependencyNode node) {
if (root == null) {
root = node;
}
if (node.getState() == DependencyNode.INCLUDED) {
ArtifactGraphNode grNode = scene.getGraphNodeRepresentant(node);
if (grNode == null) {
return false;
}
ArtifactWidget aw = (ArtifactWidget) scene.findWidget(grNode);
aw.highlightText(searchTerm);
path.push(node);
return true;
} else {
return false;
}
}
示例6: getConflictType
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
int getConflictType () {
int ret = NO_CONFLICT;
DefaultArtifactVersion includedV = new DefaultArtifactVersion(
getArtifact().getArtifact().getVersion());
int result;
for (DependencyNode curDepN : getDuplicatesOrConflicts()) {
if (curDepN.getState() == DependencyNode.OMITTED_FOR_CONFLICT) {
result = includedV.compareTo(new DefaultArtifactVersion(curDepN.getArtifact().getVersion()));
if (result < 0) {
return CONFLICT;
}
if (result > 0) {
ret = POTENTIAL_CONFLICT;
}
}
}
return ret;
}
示例7: visit
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
@Override
public boolean visit(DependencyNode node) {
if (root == null) {
root = node;
lst = new ArrayList<DependencyNode>();
}
for (DependencyNode ch : node.getChildren()) {
if (ch.getState() == DependencyNode.INCLUDED &&
scopes.contains(ch.getArtifact().getScope())) {
lst.add(ch);
}
}
return true;
}
示例8: constructRepository
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
private Repository constructRepository() throws IOException {
Repository repo = new DirRepository(classesDirectory.toPath());
if (!quiet) {
getLog().info("HuntBugs: +dir " + classesDirectory);
}
// collecting project dependencies including pom and transitive dependencies
ArtifactFilter artifactFilter = new ScopeArtifactFilter("compile");
DependencyNode rootNode;
try {
rootNode = treeBuilder.buildDependencyTree(project, session.getLocalRepository(), artifactFilter);
} catch (DependencyTreeBuilderException e) {
throw new RuntimeException(e);
}
CollectingDependencyNodeVisitor visitor = new CollectingDependencyNodeVisitor();
rootNode.accept(visitor);
// converting dependencies to type loaders
List<DependencyNode> nodes = visitor.getNodes();
List<ITypeLoader> deps = new ArrayList<>();
for (DependencyNode dependencyNode : nodes) {
int state = dependencyNode.getState();
// checking that transitive dependency is NOT excluded
if (state == DependencyNode.INCLUDED) {
Artifact artifact = dependencyNode.getArtifact();
addDependency(artifact, deps);
}
}
if (deps.isEmpty()) {
return repo;
}
return new CompositeRepository(
Arrays.asList(repo, new AuxRepository(new CompositeTypeLoader(deps.toArray(new ITypeLoader[0])))));
}
示例9: visit
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
@Override
public boolean visit(final DependencyNode node) {
final Artifact at = node.getArtifact();
final int state = node.getState();
final String key = getQualifiedName(at);
switch (state) {
case DependencyNode.INCLUDED:
resolvedDependenciesByName.put(key, at);
break;
case DependencyNode.OMITTED_FOR_CONFLICT:
DefaultArtifactVersion dav1 = new DefaultArtifactVersion(node.getArtifact()
.getVersion());
DefaultArtifactVersion dav2 = new DefaultArtifactVersion(node.getRelatedArtifact()
.getVersion());
if (isIncompatible(dav1, dav2)) {
if (conflictDependencyArtifacts.containsKey(key)) {
conflictDependencyArtifacts.get(key).add(at);
conflictDependencyArtifacts.get(key).add(node.getRelatedArtifact());
} else {
List<Artifact> ats = new ArrayList<Artifact>();
ats.add(at);
if (!key.equals(getQualifiedName(node.getRelatedArtifact()))) {
ats.add(node.getRelatedArtifact());
}
conflictDependencyArtifacts.put(key, ats);
}
}
case DependencyNode.OMITTED_FOR_CYCLE:
case DependencyNode.OMITTED_FOR_DUPLICATE:
default:
break;
}
return true;
}
示例10: isFixCandidate
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
static boolean isFixCandidate (ArtifactGraphNode node) {
Set<DependencyNode> conf = node.getDuplicatesOrConflicts();
ArtifactVersion nodeV = new DefaultArtifactVersion(node.getArtifact().getArtifact().getVersion());
for (DependencyNode dn : conf) {
if (dn.getState() == DependencyNode.OMITTED_FOR_CONFLICT) {
if (nodeV.compareTo(new DefaultArtifactVersion(dn.getArtifact().getVersion())) < 0) {
return true;
}
}
}
return false;
}
示例11: resolveExecutionClasspath
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
/**
* Resolves the processing unit's dependencies classpath.
*
* @param project the processing unit project
* @param includeScopes the scopes of the dependencies to include
* @param includeProjects whether to include project's output directories
* @param reactorProjects the reactor projects
* @param dependencyTreeBuilder the dependency tree builder
* @param metadataSource the metadata source
* @param artifactCollector the artifact collector
* @param artifactResolver the artifact resolver
* @param artifactFactory the artifact factory
* @param localRepository the local repository
* @param remoteRepositories the remote repositories
* @return a list containing all dependency URLs.
* @throws Exception
*/
static List resolveExecutionClasspath(MavenProject project, String[] includeScopes,
boolean includeProjects, List reactorProjects, DependencyTreeBuilder dependencyTreeBuilder,
ArtifactMetadataSource metadataSource, ArtifactCollector artifactCollector,
ArtifactResolver artifactResolver, ArtifactFactory artifactFactory,
ArtifactRepository localRepository, List remoteRepositories) throws Exception {
Set scopes = new HashSet(includeScopes.length);
Collections.addAll(scopes, includeScopes);
// resolve all dependency of the specifies scope
// scope 'test' is the widest scope available.
ArtifactFilter artifactFilter = new ScopeArtifactFilter("test");
DependencyNode root = dependencyTreeBuilder.buildDependencyTree(project, localRepository, artifactFactory,
metadataSource, artifactFilter,artifactCollector);
// resolve all dependency files. if the dependency is a referenced project and not
// a file in the repository add its output directory to the classpath.
Iterator i = root.preorderIterator();
Set artifacts = new HashSet();
while (i.hasNext()) {
DependencyNode node = (DependencyNode)i.next();
// the dependency may not be included due to duplication
// dependency cycles and version conflict.
// don't include those in the classpath.
if (node.getState() != DependencyNode.INCLUDED) {
PluginLog.getLog().debug("Not including dependency: " + node);
continue;
}
Artifact artifact = node.getArtifact();
if (artifact.getFile() == null) {
try {
// if file is not found an exception is thrown
artifactResolver.resolve(artifact, remoteRepositories, localRepository);
}
catch (Exception e) {
if (includeProjects) {
// try to see if the dependency is a referenced project
Iterator projectsIterator = reactorProjects.iterator();
while (projectsIterator.hasNext()) {
MavenProject proj = (MavenProject)projectsIterator.next();
if (proj.getArtifactId().equals(artifact.getArtifactId())) {
artifact.setFile(new File(proj.getBuild().getOutputDirectory()));
break;
}
}
}
}
}
if (!scopes.contains(artifact.getScope())) {
if (artifact.getScope() != null) {
continue;
}
// if it's not the same project don't add
if (!includeProjects || !project.getArtifactId().equals(artifact.getArtifactId())) {
continue;
}
}
artifacts.add(artifact);
}
return getArtifactURLs(artifacts);
}
示例12: endVisit
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
@Override public boolean endVisit(DependencyNode node) {
if (node.getState() == DependencyNode.INCLUDED) {
path.pop();
}
return true;
}
示例13: visit
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
@Override public boolean visit(DependencyNode node) {
if (root == null) {
root = node;
}
ArtifactGraphNode grNode;
boolean primary = false;
grNode = cache.get(node.getArtifact().getDependencyConflictId());
if (node.getState() == DependencyNode.INCLUDED) {
if (grNode == null) {
grNode = new ArtifactGraphNode(node);
cache.put(node.getArtifact().getDependencyConflictId(), grNode);
} else {
grNode.setArtifact(node);
}
grNode.setPrimaryLevel(path.size());
primary = true;
} else {
if (grNode == null) {
grNode = new ArtifactGraphNode(node);
Artifact a = node.getState() == DependencyNode.OMITTED_FOR_CONFLICT ? node.getRelatedArtifact() : node.getArtifact();
cache.put(a.getDependencyConflictId(), grNode);
}
grNode.addDuplicateOrConflict(node);
}
if (!path.empty()) {
DependencyNode parent = path.peek();
ArtifactGraphEdge ed = new ArtifactGraphEdge(parent, node);
ed.setLevel(path.size() - 1);
ed.setPrimaryPath(primary);
edges.add(ed);
}
if (node != root && grNode.getArtifact() != null) {
grNode.setManagedState(
obtainManagedState(grNode.getArtifact().getArtifact(), scene));
}
path.push(node);
// graphPath.push(grNode);
return true;
}