當前位置: 首頁>>代碼示例>>Java>>正文


Java MavenProject.getDependencies方法代碼示例

本文整理匯總了Java中org.apache.maven.project.MavenProject.getDependencies方法的典型用法代碼示例。如果您正苦於以下問題:Java MavenProject.getDependencies方法的具體用法?Java MavenProject.getDependencies怎麽用?Java MavenProject.getDependencies使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.maven.project.MavenProject的用法示例。


在下文中一共展示了MavenProject.getDependencies方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: populateArtifactInfo

import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
@Override public void populateArtifactInfo(ArtifactContext context) throws IOException {
    ArtifactInfo ai = context.getArtifactInfo();
    if (ai.getClassifier() != null) {
        return;
    }
    try {
        MavenProject mp = load(ai);
        if (mp != null) {
            List<Dependency> dependencies = mp.getDependencies();
            LOG.log(Level.FINER, "Successfully loaded project model from repository for {0} with {1} dependencies", new Object[] {ai, dependencies.size()});
            dependenciesByArtifact.put(ai, dependencies);
        }
    } catch (InvalidArtifactRTException ex) {
        ex.printStackTrace();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:ArtifactDependencyIndexCreator.java

示例2: resolveDependecyJarPath

import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
/**
 * Returns list of jar path.
 *
 * @param project         maven project
 * @param localRepository local repository
 * @param remoteRepos     remote repository
 * @return list of jar paths
 */
private static List<String> resolveDependecyJarPath(MavenProject project, ArtifactRepository localRepository,
                                                    List<ArtifactRepository> remoteRepos) {

    StringBuilder path = new StringBuilder();
    List<String> jarPaths = new ArrayList<>();
    for (Dependency dependency : project.getDependencies()) {

        path.append(localRepository.getBasedir());
        path.append(SLASH);
        path.append(getPackageDirPathFromJavaJPackage(dependency.getGroupId()));
        path.append(SLASH);
        path.append(dependency.getArtifactId());
        path.append(SLASH);
        path.append(dependency.getVersion());
        path.append(SLASH);
        path.append(dependency.getArtifactId() + HYPHEN + dependency.getVersion() + PERIOD + JAR);
        File jarFile = new File(path.toString());
        if (jarFile.exists()) {
            jarPaths.add(path.toString());
        }
        path.delete(0, path.length());
    }

    for (ArtifactRepository repo : remoteRepos) {
        // TODO: add resolver for remote repo.
    }
    return jarPaths;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:37,代碼來源:YangPluginUtils.java


注:本文中的org.apache.maven.project.MavenProject.getDependencies方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。