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


Java Dependency.getScope方法代码示例

本文整理汇总了Java中org.apache.maven.model.Dependency.getScope方法的典型用法代码示例。如果您正苦于以下问题:Java Dependency.getScope方法的具体用法?Java Dependency.getScope怎么用?Java Dependency.getScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.model.Dependency的用法示例。


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

示例1: run

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
@Override
public void run() {
    FileObject fo = project.getProjectDirectory().getFileObject("pom.xml"); //NOI18N
    final DependencyAdder monitor = this;
    ModelOperation<POMModel> operation = new ModelOperation<POMModel>() {
        @Override
        public void performOperation(POMModel model) {
            synchronized (monitor) {
                for (Dependency dep : toAdd) {
                    org.netbeans.modules.maven.model.pom.Dependency mdlDep =
                            ModelUtils.checkModelDependency(model, dep.getGroupId(), dep.getArtifactId(), true);
                    mdlDep.setVersion(dep.getVersion());
                    if (dep.getScope() != null) {
                        mdlDep.setScope(dep.getScope());
                    }
                }
                toAdd.clear();
            }
        }
    };
    Utilities.performPOMModelOperations(fo, Collections.singletonList(operation));
    project.getLookup().lookup(NbMavenProject.class).synchronousDependencyDownload();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:MavenNbModuleImpl.java

示例2: findConflict

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
/**
 * @return 0 -> no conflicts, 1 -> conflict in version, 2 -> conflict in scope
 */
private static int findConflict (List<Dependency> deps, String groupId, String artifactId, String version, String scope) {
    if (deps == null) {
        return 0;
    }
    for (Dependency dep : deps) {
        if (artifactId != null && artifactId.equals(dep.getArtifactId()) &&
                groupId != null && groupId.equals(dep.getGroupId())) {
            if (version != null && !version.equals(dep.getVersion())) {
                return 1;
            }
            if (scope != null) {
                if (!scope.equals(dep.getScope())) {
                    return 2;
                }
            } else if (dep.getScope() != null) {
                return 2;
            }

        }
    }

    return 0;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:AddDependencyPanel.java

示例3: filter

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
private Collection<NBVersionInfo> filter(NbMavenProject mavProj, List<NBVersionInfo> nbvis, boolean test) {


        Map<String, NBVersionInfo> items = new HashMap<String, NBVersionInfo>();
        //check dependency already added
        List<Dependency> dependencies = new ArrayList<Dependency>();
        MavenProject prj = mavProj.getMavenProject();
        if (test) {
            dependencies.addAll(prj.getTestDependencies());
        } else {
            dependencies.addAll(prj.getDependencies());
        }

        for (NBVersionInfo info : nbvis) {
            String key = info.getGroupId() + ":" + info.getArtifactId();

            boolean b = items.containsKey(key);
            if (!b) {
                items.put(key, info);
            }
            for (Dependency dependency : dependencies) {
                //check group id and ArtifactId and Scope even
                if (dependency.getGroupId() != null && dependency.getGroupId().equals(info.getGroupId())) {
                    if (dependency.getArtifactId() != null && dependency.getArtifactId().equals(info.getArtifactId())) {
                        if (!test && dependency.getScope() != null && ("compile".equals(dependency.getScope()))) {//NOI18N

                            return Collections.emptyList();
                        }
                    }
                }
            }

        }
        List<NBVersionInfo> filterd = new ArrayList<NBVersionInfo>(items.values());

        return filterd;

    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:SearchClassDependencyInRepo.java

示例4: convertDependencyToJarArtifact

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
private static Artifact convertDependencyToJarArtifact(Dependency dependency) {
    String groupId = dependency.getGroupId();
    String artifactId = dependency.getArtifactId();
    String version = dependency.getVersion();
    String scope = dependency.getScope();
    String type = dependency.getType();
    String classifier = dependency.getClassifier();
    DefaultArtifact artifact = new DefaultArtifact(groupId, artifactId, version, scope, type, classifier, JAR_ARTIFACT_HANDLER);
    return artifact;
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:11,代码来源:MavenUtil.java

示例5: removeSystemScopedDependencies

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
private void removeSystemScopedDependencies( Set<String> artifactsToRemove, List<Dependency> originalDependencies )
{
    for ( Dependency dependency : originalDependencies )
    {
        if ( dependency.getScope() != null && dependency.getScope().equalsIgnoreCase( "system" ) )
        {
            artifactsToRemove.add( getId( dependency ) );
        }
    }
}
 
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:11,代码来源:ShadeMojo.java

示例6: addSystemScopedDependencyFromNonInterpolatedPom

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
private void addSystemScopedDependencyFromNonInterpolatedPom( List<Dependency> dependencies,
                                                              List<Dependency> originalDependencies )
{
    for ( Dependency dependency : originalDependencies )
    {
        if ( dependency.getScope() != null && dependency.getScope().equalsIgnoreCase( "system" ) )
        {
            dependencies.add( dependency );
        }
    }
}
 
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:12,代码来源:ShadeMojo.java

示例7: writeDependency

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
private void writeDependency(Dependency dependency, String tagName, XmlSerializer serializer)
        throws java.io.IOException {
    serializer.startTag(NAMESPACE, tagName);
    flush(serializer);
    StringBuffer b = b(serializer);
    int start = b.length();
    if (dependency.getGroupId() != null) {
        writeValue(serializer, "groupId", dependency.getGroupId(), dependency);
    }
    if (dependency.getArtifactId() != null) {
        writeValue(serializer, "artifactId", dependency.getArtifactId(), dependency);
    }
    if (dependency.getVersion() != null) {
        writeValue(serializer, "version", dependency.getVersion(), dependency);
    }
    if ((dependency.getType() != null) && !dependency.getType().equals("jar")) {
        writeValue(serializer, "type", dependency.getType(), dependency);
    }
    if (dependency.getClassifier() != null) {
        writeValue(serializer, "classifier", dependency.getClassifier(), dependency);
    }
    if (dependency.getScope() != null) {
        writeValue(serializer, "scope", dependency.getScope(), dependency);
    }
    if (dependency.getSystemPath() != null) {
        writeValue(serializer, "systemPath", dependency.getSystemPath(), dependency);
    }
    if ((dependency.getExclusions() != null) && (dependency.getExclusions().size() > 0)) {
        serializer.startTag(NAMESPACE, "exclusions");
        for (Iterator iter = dependency.getExclusions().iterator(); iter.hasNext();) {
            Exclusion o = (Exclusion) iter.next();
            writeExclusion(o, "exclusion", serializer);
        }
        serializer.endTag(NAMESPACE, "exclusions");
    }
    if (dependency.getOptional() != null) {
        writeValue(serializer, "optional", dependency.getOptional(), dependency);
    }
    serializer.endTag(NAMESPACE, tagName).flush();
    logLocation(dependency, "", start, b.length());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:42,代码来源:LocationAwareMavenXpp3Writer.java


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