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


Java MavenProject.getBuild方法代碼示例

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


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

示例1: getCoSFile

import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
private static File getCoSFile(MavenProject mp, boolean test) {
    if (mp == null) {
        return null;
    }
    Build build = mp.getBuild();
    if (build == null) {
        return null;
    }
    String path = test ? build.getTestOutputDirectory() : build.getOutputDirectory();
    if (path == null) {
        return null;
    }
    File fl = new File(path);
    fl = FileUtil.normalizeFile(fl);
    return  new File(fl, NB_COS);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:CosChecker.java

示例2: getSharability

import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
public @Override SharabilityQuery.Sharability getSharability(URI uri) {
    //#119541 for the project's root, return MIXED right away.
    File file = FileUtil.normalizeFile(Utilities.toFile(uri));
    FileObject fo = FileUtil.toFileObject(file);
    if (fo != null && fo.equals(project.getProjectDirectory())) {
        return SharabilityQuery.Sharability.MIXED;
    }
    File basedir = FileUtil.toFile(project.getProjectDirectory());
    // is this condition necessary?
    if (!file.getAbsolutePath().startsWith(basedir.getAbsolutePath())) {
        return SharabilityQuery.Sharability.UNKNOWN;
    }
    if (basedir.equals(file.getParentFile())) {
        // Interesting cases are of direct children.
        if (file.getName().equals("pom.xml")) { // NOI18N
            return SharabilityQuery.Sharability.SHARABLE;
        }
        if ("nbproject".equals(file.getName())) { //NOI18N
            // screw the netbeans profiler directory creation.
            // #98662
            return SharabilityQuery.Sharability.NOT_SHARABLE;
        }
        if (file.getName().startsWith("nbactions")) { //NOI18N
            //non shared custom configurations shall not be added to version control.
            M2ConfigProvider configs = project.getLookup().lookup(M2ConfigProvider.class);
            if (configs != null) {
                Collection<M2Configuration> col = configs.getNonSharedConfigurations();
                for (M2Configuration conf : col) {
                    if (file.getName().equals(M2Configuration.getFileNameExt(conf.getId()))) {
                        return SharabilityQuery.Sharability.NOT_SHARABLE;
                    }
                }
            }
        }
        if (file.getName().equals("src")) { // NOI18N
            // hardcoding this name since Maven will only report particular subtrees
            return SharabilityQuery.Sharability.SHARABLE; // #174010
        }
    }

    //this part is slow if invoked on built project that is not opened (needs to load the embedder)
    //can it be replaced with code not touching the embedder?
    MavenProject proj = project.getLookup().lookup(NbMavenProject.class).getMavenProject();
    Build build = proj.getBuild();
    if (build != null && build.getDirectory() != null) {
        File target = new File(build.getDirectory());
        if (target.equals(file) || file.getAbsolutePath().startsWith(target.getAbsolutePath())) {
            return SharabilityQuery.Sharability.NOT_SHARABLE;
        }
    }

    // Some other subdir with potentially unknown contents.
    if (file.isDirectory()) {
        return SharabilityQuery.Sharability.MIXED;
    } else {
        return SharabilityQuery.Sharability.UNKNOWN;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:59,代碼來源:MavenSharabilityQueryImpl.java


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