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


Java MavenProject.getRuntimeArtifacts方法代碼示例

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


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

示例1: createExecuteCPI

import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
private ClassPathImplementation createExecuteCPI(MavenProject project, File binary) {
    List<PathResourceImplementation> items = new ArrayList<PathResourceImplementation>(); 
    items.add(ClassPathSupport.createResource(FileUtil.urlForArchiveOrDir(binary)));
    if (project != null) {
        for (Artifact s : project.getRuntimeArtifacts()) {
            if (s.getFile() == null) continue;
            items.add(ClassPathSupport.createResource(FileUtil.urlForArchiveOrDir(s.getFile())));
        }
    }
    return ClassPathSupport.createClassPathImplementation(items);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:RepositoryMavenCPProvider.java

示例2: calculateValue

import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
private boolean calculateValue() {
        NbMavenProject nbmp = project.getLookup().lookup(NbMavenProject.class);
        if (nbmp == null) {
            return true;
        }
        boolean oldVal = hasProblem.get();
        boolean newVal = false;
        try {
        MavenProject mp = nbmp.getMavenProject();
        Properties props = PluginPropertyUtils.getPluginPropertyParameter(project, "org.apache.felix", "maven-bundle-plugin", "instructions", "bundle");
        if (props != null) {
            //String embed = props.getProperty("Embed-Dependency"); //TODO should we parse it somehow?
            //are embedded ones a problem? not on CP I guess
//            if (embed != null && embed.contains("inline=true")) {
//                return false;
//            }
            String exportedPack = props.getProperty("Export-Package");
            String privatePack = props.getProperty("Private-Package");
            if (exportedPack != null || privatePack != null) {
                Matcher exported = new Matcher(exportedPack);
                Matcher prived = new Matcher(privatePack);
                for (Artifact a : mp.getRuntimeArtifacts()) { //TODO runtime or compile??
                    File f = a.getFile();
                    if (f != null && f.isFile()) {
                        try {
                            JarFile jf = new JarFile(f);
                            Enumeration<JarEntry> en = jf.entries();
                            while (en.hasMoreElements()) {
                                JarEntry je = en.nextElement();
                                if (je.isDirectory() && !je.getName().startsWith("META-INF")) { //is this optimization correct?
                                    String pack = je.getName().substring(0, je.getName().length() - 1).replace("/", "."); //last char is /
                                    if (exported.matches(pack) || prived.matches(pack)) {
                                        newVal = true;
                                        return false;
                                    }
                                }
                            }
                        } catch (IOException ex) {
                            Exceptions.printStackTrace(ex);
                        }
                    }
                }
            }
        }
        } finally {
            if (newVal != oldVal) {
                hasProblem.set(newVal);
                RP.post(new Runnable() {
                    @Override
                    public void run() {
                        pchs.firePropertyChange(ProjectProblemsProvider.PROP_PROBLEMS, null, null);
                    }
                });
            }
        }
        //according to http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html default value is just 
        //project's own sources
        return true;
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:60,代碼來源:ForeignClassBundlerImpl.java


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