当前位置: 首页>>代码示例>>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;未经允许,请勿转载。