• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MavenConstants类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jetbrains.idea.maven.model.MavenConstants的典型用法代码示例。如果您正苦于以下问题:Java MavenConstants类的具体用法?Java MavenConstants怎么用?Java MavenConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MavenConstants类属于org.jetbrains.idea.maven.model包,在下文中一共展示了MavenConstants类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: value

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
public boolean value(final VirtualFile file) {
  String fileName = file.getName();

  // MavenDomUtil.isProjectFile(PsiFile)
  if (fileName.equals(MavenConstants.POM_XML) || fileName.endsWith(".pom") || fileName.equals(MavenConstants.SUPER_POM_XML)) {
    return true;
  }

  // MavenDomUtil.isProfilesFile(PsiFile)
  if (fileName.equals(MavenConstants.PROFILES_XML)) {
    return true;
  }

  if (fileName.equals(MavenConstants.SETTINGS_XML)) {
    return true;
  }

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


示例2: getPhaseVariants

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
public static List<LookupElement> getPhaseVariants(MavenProjectsManager manager) {
  Set<String> goals = new HashSet<String>();
  goals.addAll(MavenConstants.PHASES);

  for (MavenProject mavenProject : manager.getProjects()) {
    for (MavenPlugin plugin : mavenProject.getPlugins()) {
      MavenPluginInfo pluginInfo = MavenArtifactUtil.readPluginInfo(manager.getLocalRepository(), plugin.getMavenId());
      if (pluginInfo != null) {
        for (MavenPluginInfo.Mojo mojo : pluginInfo.getMojos()) {
          goals.add(mojo.getDisplayName());
        }
      }
    }
  }

  List<LookupElement> res = new ArrayList<LookupElement>(goals.size());
  for (String goal : goals) {
    res.add(LookupElementBuilder.create(goal).withIcon(MavenIcons.Phase));
  }

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


示例3: isSettingsFile

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
public static boolean isSettingsFile(PsiFile file) {
  if (!(file instanceof XmlFile)) return false;

  String name = file.getName();
  if (!name.equals(MavenConstants.SETTINGS_XML)) return false;

  XmlTag rootTag = ((XmlFile)file).getRootTag();
  if (rootTag == null || !"settings".equals(rootTag.getName())) return false;

  String xmlns = rootTag.getAttributeValue("xmlns");
  if (xmlns != null) {
    return xmlns.contains("maven");
  }

  boolean hasTag = false;

  for (PsiElement e = rootTag.getFirstChild(); e != null; e = e.getNextSibling()) {
    if (e instanceof XmlTag) {
      if (SUBTAGS_IN_SETTINGS_FILE.contains(((XmlTag)e).getName())) return true;
      hasTag = true;
    }
  }

  return !hasTag;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:MavenDomUtil.java


示例4: isMavenModule

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
@Override
public boolean isMavenModule(@NotNull final File file) {
    Validate.notNull(file);
    if (file.getAbsolutePath().contains(HybrisConstants.PLATFORM_MODULE_PREFIX)) {
        return false;
    }
    return new File(file, MavenConstants.POM_XML).isFile();
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:9,代码来源:DefaultHybrisProjectService.java


示例5: createPomFile

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
private VirtualFile createPomFile(final Project project, final MavenId projectId, final String muleVersion, final VirtualFile root)
{
    return new WriteCommandAction<VirtualFile>(project, "Create Mule Domain Project", PsiFile.EMPTY_ARRAY)
    {
        @Override
        protected void run(@NotNull Result<VirtualFile> result) throws Throwable
        {

            try
            {
                VirtualFile pomFile = root.findOrCreateChildData(this, MavenConstants.POM_XML);
                final Properties templateProps = new Properties();
                templateProps.setProperty("GROUP_ID", projectId.getGroupId());
                templateProps.setProperty("ARTIFACT_ID", projectId.getArtifactId());
                templateProps.setProperty("VERSION", projectId.getVersion());
                templateProps.setProperty("MULE_VERSION", muleVersion);
                final FileTemplateManager manager = FileTemplateManager.getInstance(project);
                final FileTemplate template = manager.getInternalTemplate(MuleFileTemplateDescriptorManager.MULE_DOMAIN_MAVEN_PROJECT);
                final Properties defaultProperties = manager.getDefaultProperties();
                defaultProperties.putAll(templateProps);
                final String text = template.getText(defaultProperties);
                VfsUtil.saveText(pomFile, text);
                result.setResult(pomFile);
            }
            catch (IOException e)
            {
                showError(project, e);
            }
        }
    }.execute().getResultObject();
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:32,代码来源:MuleDomainMavenProjectBuilderHelper.java


示例6: createModulePomFile

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
private VirtualFile createModulePomFile(final Project project, final MavenId projectId, final VirtualFile root, final MavenId parentId)
{
    return new WriteCommandAction<VirtualFile>(project, "Create Mule Project", PsiFile.EMPTY_ARRAY)
    {
        @Override
        protected void run(@NotNull Result<VirtualFile> result) throws Throwable
        {
            try
            {
                VirtualFile pomFile = root.findOrCreateChildData(this, MavenConstants.POM_XML);
                final Properties templateProps = new Properties();
                templateProps.setProperty("GROUP_ID", parentId.getGroupId());
                templateProps.setProperty("ARTIFACT_ID", projectId.getArtifactId());
                templateProps.setProperty("PARENT_ID", parentId.getArtifactId());
                templateProps.setProperty("VERSION", parentId.getVersion());

                final FileTemplateManager manager = FileTemplateManager.getInstance(project);
                final FileTemplate template = manager.getInternalTemplate(MuleFileTemplateDescriptorManager.MULE_MAVEN_MODULE);
                final Properties defaultProperties = manager.getDefaultProperties();
                defaultProperties.putAll(templateProps);
                final String text = template.getText(defaultProperties);
                VfsUtil.saveText(pomFile, text);
                result.setResult(pomFile);
            }
            catch (IOException e)
            {
                showError(project, e);
            }
        }
    }.execute().getResultObject();
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:32,代码来源:MuleMavenProjectBuilderHelper.java


示例7: createPomFile

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
private VirtualFile createPomFile(final Project project, final MavenId projectId, final String muleVersion, final VirtualFile root)
{
    return new WriteCommandAction<VirtualFile>(project, "Create Mule Project", PsiFile.EMPTY_ARRAY)
    {
        @Override
        protected void run(@NotNull Result<VirtualFile> result) throws Throwable
        {

            try
            {
                VirtualFile pomFile = root.findOrCreateChildData(this, MavenConstants.POM_XML);
                final Properties templateProps = new Properties();
                templateProps.setProperty("GROUP_ID", projectId.getGroupId());
                templateProps.setProperty("ARTIFACT_ID", projectId.getArtifactId());
                templateProps.setProperty("VERSION", projectId.getVersion());
                templateProps.setProperty("MULE_VERSION", muleVersion);
                final FileTemplateManager manager = FileTemplateManager.getInstance(project);
                final FileTemplate template = manager.getInternalTemplate(MuleFileTemplateDescriptorManager.MULE_MAVEN_PROJECT);
                final Properties defaultProperties = manager.getDefaultProperties();
                defaultProperties.putAll(templateProps);
                final String text = template.getText(defaultProperties);
                VfsUtil.saveText(pomFile, text);
                result.setResult(pomFile);
            }
            catch (IOException e)
            {
                showError(project, e);
            }
        }
    }.execute().getResultObject();
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:32,代码来源:MuleMavenProjectBuilderHelper.java


示例8: containsCompileDependency

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
private static boolean containsCompileDependency(Collection<MavenArtifact> dependencies) {
  for (MavenArtifact dependency : dependencies) {
    if (MavenConstants.SCOPE_COMPILE.equals(dependency.getScope())) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AndroidMavenUtil.java


示例9: importExternalAndroidLibDependencies

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
private static void importExternalAndroidLibDependencies(Project project,
                                                         MavenRootModelAdapter rootModelAdapter,
                                                         IdeModifiableModelsProvider modelsProvider,
                                                         MavenProjectsTree mavenTree,
                                                         MavenProject mavenProject,
                                                         Map<MavenProject, String> mavenProject2ModuleName,
                                                         List<MavenProjectsProcessorTask> tasks) {
  final ModifiableRootModel rootModel = rootModelAdapter.getRootModel();
  removeUselessDependencies(rootModel, modelsProvider, mavenProject);

  for (MavenArtifact depArtifact : mavenProject.getDependencies()) {
    if (mavenTree.findProject(depArtifact) != null) {
      continue;
    }
    final String type = depArtifact.getType();

    if (AndroidMavenUtil.APKLIB_DEPENDENCY_AND_PACKAGING_TYPE.equals(type)) {
      final AndroidExternalApklibDependenciesManager.MavenDependencyInfo depInfo =
        AndroidExternalApklibDependenciesManager.MavenDependencyInfo.create(depArtifact);

      final String apklibModuleName = doImportExternalApklibDependency(
        project, modelsProvider, mavenTree, mavenProject,
        mavenProject2ModuleName, tasks, depInfo);

      if (ArrayUtil.find(rootModel.getDependencyModuleNames(), apklibModuleName) < 0) {
        final DependencyScope scope = getApklibModuleDependencyScope(depArtifact);

        if (scope != null) {
          addModuleDependency(modelsProvider, rootModel, apklibModuleName, scope);
        }
      }
    }
    else if (AndroidMavenUtil.AAR_DEPENDENCY_AND_PACKAGING_TYPE.equals(type) &&
             MavenConstants.SCOPE_COMPILE.equals(depArtifact.getScope())) {
      importExternalAarDependency(depArtifact, mavenProject, mavenTree, rootModelAdapter, modelsProvider, project, tasks);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:AndroidFacetImporterBase.java


示例10: getApklibModuleDependencyScope

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
@Nullable
private static DependencyScope getApklibModuleDependencyScope(@NotNull MavenArtifact apklibArtifact) {
  final String scope = apklibArtifact.getScope();

  if (MavenConstants.SCOPE_COMPILE.equals(scope)) {
    return DependencyScope.COMPILE;
  }
  else if (MavenConstants.SCOPE_PROVIDED.equals(scope)) {
    return DependencyScope.PROVIDED;
  }
  else if (MavenConstants.SCOPE_TEST.equals(scope)) {
    return DependencyScope.TEST;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:AndroidFacetImporterBase.java


示例11: resolve

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
@Override
public void resolve(final Project project,
                    MavenProject mavenProject,
                    NativeMavenProjectHolder nativeMavenProject,
                    MavenEmbedderWrapper embedder,
                    ResolveContext context)
  throws MavenProcessCanceledException {
  final AndroidExternalApklibDependenciesManager adm =
    AndroidExternalApklibDependenciesManager.getInstance(project);

  for (MavenArtifact depArtifact : mavenProject.getDependencies()) {
    final MavenProjectsManager mavenProjectsManager = MavenProjectsManager.getInstance(project);

    if (AndroidMavenUtil.APKLIB_DEPENDENCY_AND_PACKAGING_TYPE.equals(depArtifact.getType()) &&
        mavenProjectsManager.findProject(depArtifact) == null &&
        MavenConstants.SCOPE_COMPILE.equals(depArtifact.getScope())) {

      Set<MavenId> resolvedArtifacts = context.getUserData(RESOLVED_APKLIB_ARTIFACTS_KEY);

      if (resolvedArtifacts == null) {
        resolvedArtifacts = new HashSet<MavenId>();
        context.putUserData(RESOLVED_APKLIB_ARTIFACTS_KEY, resolvedArtifacts);
      }
      if (resolvedArtifacts.add(depArtifact.getMavenId())) {
        doResolveApklibArtifact(project, depArtifact, embedder, mavenProjectsManager, mavenProject.getName(), adm, context);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:AndroidFacetImporterBase.java


示例12: process

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
@Nullable
public RESULT_TYPE process(@NotNull MavenGeneralSettings generalSettings,
                           @NotNull VirtualFile projectFile,
                           @Nullable MavenParentDesc parentDesc) {
  VirtualFile superPom = generalSettings.getEffectiveSuperPom();
  if (superPom == null || projectFile.equals(superPom)) return null;

  RESULT_TYPE result = null;

  if (parentDesc == null) {
    return processSuperParent(superPom);
  }

  VirtualFile parentFile = findManagedFile(parentDesc.getParentId());
  if (parentFile != null) {
    result = processManagedParent(parentFile);
  }

  if (result == null) {
    parentFile = projectFile.getParent().findFileByRelativePath(parentDesc.getParentRelativePath());
    if (parentFile != null && parentFile.isDirectory()) {
      parentFile = parentFile.findFileByRelativePath(MavenConstants.POM_XML);
    }
    if (parentFile != null) {
      result = processRelativeParent(parentFile);
    }
  }

  if (result == null) {
    File parentIoFile = MavenArtifactUtil.getArtifactFile(generalSettings.getEffectiveLocalRepository(),
                                                          parentDesc.getParentId(), "pom");
    parentFile = LocalFileSystem.getInstance().findFileByIoFile(parentIoFile);
    if (parentFile != null) {
      result = processRepositoryParent(parentFile);
    }
  }

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


示例13: collectGoals

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
private static List<String> collectGoals(MavenProject project) {
  LinkedHashSet<String> result = new LinkedHashSet<String>(); // may contains similar plugins or somethig
  result.addAll(MavenConstants.PHASES);

  for (MavenPlugin each : project.getDeclaredPlugins()) {
    collectGoals(project.getLocalRepository(), each, result);
  }

  return new ArrayList<String>(result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:MavenKeymapExtension.java


示例14: fixAfterLoadingFromOldFormat

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
public void fixAfterLoadingFromOldFormat() {
  for (String profile : myEnabledProfilesForXmlSerializer) {
    myProfilesMap.put(profile, true);
  }
  myEnabledProfilesForXmlSerializer.clear();

  File workingDir = getWorkingDirFile();
  if (MavenConstants.POM_XML.equals(workingDir.getName())) {
    setWorkingDirPath(workingDir.getParent());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:MavenRunnerParameters.java


示例15: isProjectFile

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
public static boolean isProjectFile(PsiFile file) {
  if (!(file instanceof XmlFile)) return false;

  String name = file.getName();
  return name.equals(MavenConstants.POM_XML) ||
         name.endsWith(".pom") ||
         name.equals(MavenConstants.SUPER_POM_XML);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:MavenDomUtil.java


示例16: resolve

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
public PsiElement resolve() {
  VirtualFile baseDir = myPsiFile.getVirtualFile().getParent();
  String relPath = FileUtil.toSystemIndependentName(myText + "/" + MavenConstants.POM_XML);
  VirtualFile file = baseDir.findFileByRelativePath(relPath);

  if (file == null) return null;

  return getPsiFile(file);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:MavenModulePsiReference.java


示例17: calcRelativeModulePath

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
public static String calcRelativeModulePath(VirtualFile parentPom, VirtualFile modulePom) {
  String result = MavenDomUtil.calcRelativePath(parentPom.getParent(), modulePom);
  int to = result.length() - ("/" + MavenConstants.POM_XML).length();
  if (to < 0) {
    // todo IDEADEV-35440
    throw new RuntimeException("Filed to calculate relative path for:" +
                               "\nparentPom: " + parentPom + "(valid: " + parentPom.isValid() + ")" +
                               "\nmodulePom: " + modulePom + "(valid: " + modulePom.isValid() + ")" +
                               "\nequals:" + parentPom.equals(modulePom));
  }
  return result.substring(0, to);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:MavenModulePsiReference.java


示例18: getValues

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
@Override
protected Collection<String> getValues(@NotNull ConvertContext context, @NotNull MavenProject project) {
  Set<String> scopes = project.getSupportedDependencyScopes();

  boolean isDependencyManagement = context.getInvocationElement().getParentOfType(MavenDomDependencyManagement.class, false) != null;
  if (isDependencyManagement) scopes.add(MavenConstants.SCOPE_IMPORT);

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


示例19: fromString

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
@Override
public PsiFile fromString(@Nullable @NonNls String s, ConvertContext context) {
  if (StringUtil.isEmptyOrSpaces(s)) return null;

  VirtualFile contextFile = context.getFile().getVirtualFile();
  if (contextFile == null) return null;

  VirtualFile f = contextFile.getParent().findFileByRelativePath(s);
  if (f == null) return null;

  if (f.isDirectory()) f = f.findChild(MavenConstants.POM_XML);
  if (f == null) return null;

  return context.getPsiManager().findFile(f);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:MavenParentRelativePathConverter.java


示例20: getStandardGoalOrder

import org.jetbrains.idea.maven.model.MavenConstants; //导入依赖的package包/类
private int getStandardGoalOrder(String goal) {
  if (standardGoalOrder == null) {
    standardGoalOrder = new THashMap<String, Integer>();
    int i = 0;
    for (String aGoal : MavenConstants.PHASES) {
      standardGoalOrder.put(aGoal, i++);
    }
  }
  Integer order = standardGoalOrder.get(goal);
  return order != null ? order.intValue() : standardGoalOrder.size();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:MavenProjectsNavigatorPanel.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IndentedWriter类代码示例发布时间:2022-05-23
下一篇:
Java XmlTag类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap