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


Java MavenProject.getDirectory方法代码示例

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


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

示例1: checkOrPerform

import org.jetbrains.idea.maven.project.MavenProject; //导入方法依赖的package包/类
private static boolean checkOrPerform(DataContext context, boolean perform) {
  final List<String> goals = MavenDataKeys.MAVEN_GOALS.getData(context);
  if (goals == null || goals.isEmpty()) return false;

  final Project project = MavenActionUtil.getProject(context);
  if(project == null) return false;
  final MavenProject mavenProject = MavenActionUtil.getMavenProject(context);
  if (mavenProject == null) return false;

  if (!perform) return true;

  final MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(context);
  if(projectsManager == null) return false;
  MavenExplicitProfiles explicitProfiles = projectsManager.getExplicitProfiles();
  final MavenRunnerParameters params = new MavenRunnerParameters(true,
                                                                 mavenProject.getDirectory(),
                                                                 goals,
                                                                 explicitProfiles.getEnabledProfiles(),
                                                                 explicitProfiles.getDisabledProfiles());
  MavenRunConfigurationType.runConfiguration(project, params, null);

  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:RunBuildAction.java

示例2: getRelativeAnnotationProcessorDirectory

import org.jetbrains.idea.maven.project.MavenProject; //导入方法依赖的package包/类
@Nullable
private static String getRelativeAnnotationProcessorDirectory(MavenProject mavenProject, boolean isTest) {
  String annotationProcessorDirectory = mavenProject.getAnnotationProcessorDirectory(isTest);
  File annotationProcessorDirectoryFile = new File(annotationProcessorDirectory);
  if (!annotationProcessorDirectoryFile.isAbsolute()) {
    return annotationProcessorDirectory;
  }

  String absoluteProjectDirectory = mavenProject.getDirectory();
  return FileUtil.getRelativePath(new File(absoluteProjectDirectory), annotationProcessorDirectoryFile);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:MavenAnnotationProcessorConfigurer.java

示例3: generateModulePath

import org.jetbrains.idea.maven.project.MavenProject; //导入方法依赖的package包/类
private static String generateModulePath(MavenProject project,
                                         Map<MavenProject, String> mavenProjectToModuleName,
                                         String dedicatedModuleDir) {
  String dir = StringUtil.isEmptyOrSpaces(dedicatedModuleDir)
               ? project.getDirectory()
               : dedicatedModuleDir;
  String fileName = mavenProjectToModuleName.get(project) + ModuleFileType.DOT_DEFAULT_EXTENSION;
  return new File(dir, fileName).getPath();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:MavenModuleNameMapper.java

示例4: doResolveProperty

import org.jetbrains.idea.maven.project.MavenProject; //导入方法依赖的package包/类
@Nullable
private static String doResolveProperty(String propName,
                                        MavenProjectsManager projectsManager,
                                        MavenProject mavenProject,
                                        Properties additionalProperties) {
  boolean hasPrefix = false;
  String unprefixed = propName;

  if (propName.startsWith("pom.")) {
    unprefixed = propName.substring("pom.".length());
    hasPrefix = true;
  }
  else if (propName.startsWith("project.")) {
    unprefixed = propName.substring("project.".length());
    hasPrefix = true;
  }

  MavenProject selectedProject = mavenProject;

  while (unprefixed.startsWith("parent.")) {
    MavenId parentId = selectedProject.getParentId();
    if (parentId == null) return null;

    unprefixed = unprefixed.substring("parent.".length());

    if (unprefixed.equals("groupId")) {
      return parentId.getGroupId();
    }
    if (unprefixed.equals("artifactId")) {
      return parentId.getArtifactId();
    }
    if (unprefixed.equals("version")) {
      return parentId.getVersion();
    }

    selectedProject = projectsManager.findProject(parentId);
    if (selectedProject == null) return null;
  }

  if (unprefixed.equals("basedir") || (hasPrefix && mavenProject == selectedProject && unprefixed.equals("baseUri"))) {
    return selectedProject.getDirectory();
  }

  if ("java.home".equals(propName)) {
    String jreDir = MavenUtil.getModuleJreHome(projectsManager, mavenProject);
    if (jreDir != null) {
      return jreDir;
    }
  }

  if ("java.version".equals(propName)) {
    String javaVersion = MavenUtil.getModuleJavaVersion(projectsManager, mavenProject);
    if (javaVersion != null) {
      return javaVersion;
    }
  }

  String result;

  result = MavenUtil.getPropertiesFromMavenOpts().get(propName);
  if (result != null) return result;

  result = MavenServerUtil.collectSystemProperties().getProperty(propName);
  if (result != null) return result;

  result = selectedProject.getModelMap().get(unprefixed);
  if (result != null) return result;

  result = additionalProperties.getProperty(propName);
  if (result != null) return result;

  result = mavenProject.getProperties().getProperty(propName);
  if (result != null) return result;

  if ("settings.localRepository".equals(propName)) {
    return mavenProject.getLocalRepository().getAbsolutePath();
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:81,代码来源:MavenPropertyResolver.java


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