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


Java MavenProject.getBasedir方法代码示例

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


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

示例1: performHandleRepository

import org.apache.maven.project.MavenProject; //导入方法依赖的package包/类
private void performHandleRepository ( final MavenProject project ) throws Exception, XPathExpressionException
{
    final File file = new File ( project.getBasedir (), "category.xml" );
    if ( !file.exists () )
    {
        return;
    }

    final Document doc = XmlHelper.parse ( file );

    for ( final Node node : XmlHelper.findNodes ( doc, "/site/feature" ) )
    {
        final Element ele = (Element)node;

        final String featureId = ele.getAttribute ( "id" );
        final String featureVersion = getVersion ( "feature", featureId );

        ele.setAttribute ( "version", featureVersion );
        ele.setAttribute ( "url", String.format ( "features/%s_%s.jar", featureId, featureVersion ) );
    }

    XmlHelper.write ( doc, file );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:24,代码来源:AbstractSetQualifierMojo.java

示例2: getBndrunPath

import org.apache.maven.project.MavenProject; //导入方法依赖的package包/类
private String getBndrunPath(MavenProject project) throws MavenExecutionException {
	String bndrunName = project.getProperties().getProperty(Constants.PROP_CONFIG_BNDRUN, "");
	if (bndrunName.trim().isEmpty()) {
		bndrunName = project.getName() + ".bndrun";
	}
	
	File existingBndrunFile = new File(project.getBasedir(), bndrunName);
	File targetBndrunFile = emProjectHome.resolve(bndrunName).toFile();

	if (existingBndrunFile.exists()) {
		if (existingBndrunFile.isFile()) {
			logger.info("Found `" + existingBndrunFile.getName() + "` in project's folder and will use it as is! POM config is ignored!");
			try {
				Files.copy(existingBndrunFile.toPath(), targetBndrunFile.toPath());
			} catch (IOException e) {
				throw new MavenExecutionException("Failed to copy file!", e);
			}
		} else {
			throw new MavenExecutionException("'" + existingBndrunFile + "' is not a file!", project.getFile());
		}
	} else {
		String distro = project.getProperties().getProperty(INTERNAL_DISTRO_FILE, "");
		generateBndrun(project, distro, targetBndrunFile);
	}
	
	return targetBndrunFile.getAbsolutePath();
}
 
开发者ID:commsen,项目名称:EM,代码行数:28,代码来源:BndExportPlugin.java

示例3: createEvaluator

import org.apache.maven.project.MavenProject; //导入方法依赖的package包/类
/**
 * Evaluator usable for interpolating variables in non resolved (interpolated) models.
 * Should not be necessary when dealing with the project's <code>MavenProject</code> instance accessed via<code>NbMavenProject.getMavenProject()</code>
 * Please NOTE that if you have access to <code>Project</code> instance, then
 * the variant with <code>Project</code> as parameter is preferable. Faster and less prone to deadlock.     
 * @since 2.32
 */
public static @NonNull ExpressionEvaluator createEvaluator(@NonNull MavenProject prj) {
    ExpressionEvaluator eval = (ExpressionEvaluator) prj.getContextValue(CONTEXT_EXPRESSION_EVALUATOR);
    if (eval != null) {
        return eval;
    }
    Map<? extends String,? extends String> sysprops = Collections.emptyMap();
    Map<? extends String,? extends String> userprops = Collections.emptyMap();
    File basedir = prj.getBasedir();
    if (basedir != null) {
    FileObject bsd = FileUtil.toFileObject(basedir);
    if (bsd != null) {
        Project p = FileOwnerQuery.getOwner(bsd);
        if (p != null) {
            NbMavenProjectImpl project = p.getLookup().lookup(NbMavenProjectImpl.class);
            if (project != null) {
                sysprops = project.createSystemPropsForPropertyExpressions();
                userprops = project.createUserPropsForPropertyExpressions();
            }
        }
    }
    }
    //ugly
    Settings ss = EmbedderFactory.getProjectEmbedder().getSettings();
    ss.setLocalRepository(EmbedderFactory.getProjectEmbedder().getLocalRepository().getBasedir());

    eval = new NBPluginParameterExpressionEvaluator(
            prj,
            ss,
            sysprops,
            userprops);
    prj.setContextValue(CONTEXT_EXPRESSION_EVALUATOR, eval);
    return eval;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:PluginPropertyUtils.java

示例4: findReactor

import org.apache.maven.project.MavenProject; //导入方法依赖的package包/类
/**
 * Tries to find the reactor root starting from what may be just a submodule.
 * The intent is that running {@code mvn -f $reactor/pom.xml --projects $module} would work.
 * @param module a project to start the search at
 * @return its apparent reactor root; maybe just the same project
 */
public static @NonNull NbMavenProject findReactor(@NonNull NbMavenProject module) { // #197232
    MavenProject prj = module.getMavenProject();
    List<ModelDescription> models = MavenEmbedder.getModelDescriptors(prj);
    File moduleDir = prj.getBasedir();
    File current = moduleDir;
    if (current != null && models != null) { //models are null for totally broken projects..
        boolean first = true;
        for (ModelDescription model : models) {
            if (first) { //ignore the first value, it's the current project
                first = false;
                continue;
            }
            File loc = model.getLocation();
            if (loc == null || loc.getName().endsWith(".pom")) {
                break;
            }
            File modelDir = loc.getParentFile();
            if (listsModule(modelDir, current, model.getModules())) {
                current = modelDir;
            } else {
                break;
            }
        }
        if (!moduleDir.equals(current)) {
            NbMavenProject loaded = load(current);
            if (loaded != null) {
                return findReactor(loaded);
            }
        }
    }
    NbMavenProject p = load(prj.getBasedir().getParentFile());
    if (p != null && listsModule(moduleDir.getParentFile(), moduleDir, p.getMavenProject().getModules())) {
        return findReactor(p);
    }
    return module;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:43,代码来源:ReactorChecker.java

示例5: NBPluginParameterExpressionEvaluator

import org.apache.maven.project.MavenProject; //导入方法依赖的package包/类
public NBPluginParameterExpressionEvaluator( 
                                           MavenProject project, 
                                           Settings settings,
                                           Map<? extends String,? extends String> systemProperties,
                                           Map<? extends String,? extends String> userProperties)
{
    this.pathTranslator = new DefaultPathTranslator();
    this.systemProperties = systemProperties;
    this.userProperties = userProperties;
    this.project = project;
    this.settings = settings;

    String bsdir = null;

    if ( project != null )
    {
        File projectFile = project.getBasedir();

        // this should always be the case for non-super POM instances...
        if ( projectFile != null )
        {
            bsdir = projectFile.getAbsolutePath();
        }
    }

    if ( bsdir == null )
    {
        bsdir = System.getProperty( "user.dir" );
    }

    this.basedir = bsdir;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:NBPluginParameterExpressionEvaluator.java

示例6: setMavenProject

import org.apache.maven.project.MavenProject; //导入方法依赖的package包/类
@Override
public void setMavenProject(final MavenProject project) {
    this.projectBaseDir = project.getBasedir();
    LOG.debug("{}: project base dir: {}", getClass().getCanonicalName(), this.projectBaseDir);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:JMXGenerator.java


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