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

Java MavenUtil类代码示例

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

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



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

示例1: configure

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
public void configure(final Project project, final MavenId projectId, final String muleVersion, final VirtualFile root)
{
    try
    {
        //Create mule folders.
        final VirtualFile appDirectory = VfsUtil.createDirectories(root.getPath() + "/src/main/domain");
        final VirtualFile resources = VfsUtil.createDirectories(root.getPath() + "/src/main/resources");
        final VirtualFile muleConfigFile = createMuleConfigFile(project, projectId, appDirectory);
        createMuleDeployPropertiesFile(project, projectId, appDirectory);
        createPomFile(project, projectId, muleVersion, root);
        // execute when current dialog is closed (e.g. Project Structure)
        MavenUtil.invokeLater(project, ModalityState.NON_MODAL, () -> EditorHelper.openInEditor(getPsiFile(project, muleConfigFile)));

    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:20,代码来源:MuleDomainMavenProjectBuilderHelper.java


示例2: setupRootModel

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
@Override
public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
    super.setupRootModel(rootModel);

    addListener(new ModuleBuilderListener() {
        @Override
        public void moduleCreated(@NotNull Module module) {
            setMuleFramework(module);
        }
    });

    setMuleFacet(rootModel.getModule());

    final Project project = rootModel.getProject();
    final VirtualFile root = createAndGetContentEntry();
    rootModel.addContentEntry(root);

    //Check if this is a module and has parent
    final MavenId parentId = (this.getParentProject() != null ? this.getParentProject().getMavenId() : null);

    MavenUtil.runWhenInitialized(project, (DumbAwareRunnable) () -> {
        new MuleMavenProjectBuilderHelper().configure(project, getProjectId(), muleVersion, root, parentId);
    });
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:25,代码来源:MuleMavenModuleBuilder.java


示例3: processResources

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
static boolean processResources(Project project,
                                VirtualFile sourceRoot,
                                VirtualFile file,
                                List<Pattern> includes,
                                List<Pattern> excludes,
                                String resOutputDir,
                                ResourceProcessor processor) {
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  if (!fileIndex.isExcluded(file)) {
    String relPath = VfsUtilCore.getRelativePath(file, sourceRoot, '/');
    if (relPath != null && MavenUtil.isIncluded(relPath, includes, excludes)) {
      if (processor.process(file, resOutputDir + "/" + relPath)) {
        return true;
      }
    }
  }
  if (file.isDirectory()) {
    for (VirtualFile child : file.getChildren()) {
      if (processResources(project, sourceRoot, child, includes, excludes, resOutputDir, processor)) {
        return true;
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AndroidMavenProviderImpl.java


示例4: perform

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
public void perform(final Project project, MavenEmbeddersManager embeddersManager, MavenConsole console, MavenProgressIndicator indicator)
  throws MavenProcessCanceledException {
  MavenArtifactDownloader.DownloadResult result =
    myTree.downloadSourcesAndJavadocs(project, myProjects, myArtifacts, myDownloadSources, myDownloadDocs, embeddersManager, console, indicator);
  if (myCallbackResult != null) myCallbackResult.setDone(result);

  // todo: hack to update all file pointers.
  MavenUtil.invokeLater(project, new Runnable() {
    public void run() {
      AccessToken accessToken = WriteAction.start();
      try {
        ProjectRootManagerEx.getInstanceEx(project).makeRootsChange(EmptyRunnable.getInstance(), false, true);
      }
      finally {
        accessToken.finish();
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MavenProjectsProcessorArtifactsDownloadingTask.java


示例5: collectProfiles

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
private List<MavenProfile> collectProfiles(VirtualFile projectFile,
                                           Element xmlProject,
                                           Collection<MavenProjectProblem> problems,
                                           Set<String> alwaysOnProfiles) {
  List<MavenProfile> result = new ArrayList<MavenProfile>();
  collectProfiles(MavenJDOMUtil.findChildrenByPath(xmlProject, "profiles", "profile"), result, MavenConstants.PROFILE_FROM_POM);

  VirtualFile profilesFile = MavenUtil.findProfilesXmlFile(projectFile);
  if (profilesFile != null) {
    collectProfilesFromSettingsXmlOrProfilesXml(profilesFile,
                                                "profilesXml",
                                                true,
                                                MavenConstants.PROFILE_FROM_PROFILES_XML,
                                                result,
                                                alwaysOnProfiles,
                                                problems);
  }

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


示例6: createUIComponents

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
private void createUIComponents() {
  mavenHomeField = new TextFieldWithHistory();
  mavenHomeField.setHistorySize(-1);
  final ArrayList<String> foundMavenHomes = new ArrayList<String>();
  foundMavenHomes.add(MavenServerManager.BUNDLED_MAVEN_2);
  foundMavenHomes.add(MavenServerManager.BUNDLED_MAVEN_3);
  final File mavenHomeDirectory = MavenUtil.resolveMavenHomeDirectory(null);
  if (mavenHomeDirectory != null) {
    foundMavenHomes.add(FileUtil.toSystemIndependentName(mavenHomeDirectory.getPath()));
  }
  mavenHomeField.setHistory(foundMavenHomes);
  mavenHomeComponent = LabeledComponent.create(
    new ComponentWithBrowseButton<TextFieldWithHistory>(mavenHomeField, null), "Maven &amp;home directory");

  final JBLabel versionLabel = new JBLabel();
  versionLabel.setOpaque(true);
  versionLabel.setVerticalAlignment(SwingConstants.TOP);
  versionLabel.setVerticalTextPosition(SwingConstants.TOP);
  mavenVersionLabelComponent = LabeledComponent.create(versionLabel, "");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:MavenEnvironmentForm.java


示例7: runConfiguration

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
public static void runConfiguration(Project project,
                                    @NotNull MavenRunnerParameters params,
                                    @Nullable MavenGeneralSettings settings,
                                    @Nullable  MavenRunnerSettings runnerSettings,
                                    @Nullable ProgramRunner.Callback callback) {
  RunnerAndConfigurationSettings configSettings = createRunnerAndConfigurationSettings(settings,
                                                                                       runnerSettings,
                                                                                       params,
                                                                                       project);

  ProgramRunner runner = DefaultJavaProgramRunner.getInstance();
  Executor executor = DefaultRunExecutor.getRunExecutorInstance();
  try {
    runner.execute(new ExecutionEnvironment(executor, runner, configSettings, project), callback);
  }
  catch (ExecutionException e) {
    MavenUtil.showError(project, "Failed to execute Maven goal", e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MavenRunConfigurationType.java


示例8: createEmbedder

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
public MavenEmbedderWrapper createEmbedder(final Project project, final boolean alwaysOnline) {
  return new MavenEmbedderWrapper(this) {
    @NotNull
    @Override
    protected MavenServerEmbedder create() throws RemoteException {
      MavenServerSettings settings = convertSettings(MavenProjectsManager.getInstance(project).getGeneralSettings());
      if (alwaysOnline && settings.isOffline()) {
        settings = settings.clone();
        settings.setOffline(false);
      }

      settings.setProjectJdk(MavenUtil.getSdkPath(ProjectRootManager.getInstance(project).getProjectSdk()));

      return MavenServerManager.this.getOrCreateWrappee().createEmbedder(settings);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MavenServerManager.java


示例9: applyFix

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor d) {
  try {
    VirtualFile modulePom = createModulePom();
    MavenId id = MavenDomUtil.describe(myPsiFile);

    String groupId = id.getGroupId() == null ? "groupId" : id.getGroupId();
    String artifactId = modulePom.getParent().getName();
    String version = id.getVersion() == null ? "version" : id.getVersion();
    MavenUtil.runOrApplyMavenProjectFileTemplate(project,
                                                 modulePom,
                                                 new MavenId(groupId, artifactId, version),
                                                 myWithParent ? id : null,
                                                 myPsiFile.getVirtualFile(),
                                                 true);
  }
  catch (IOException e) {
    MavenUtil.showError(project, "Cannot create a module", e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MavenModulePsiReference.java


示例10: setupRootModel

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
  final Project project = rootModel.getProject();

  final VirtualFile root = createAndGetContentEntry();
  rootModel.addContentEntry(root);

  // todo this should be moved to generic ModuleBuilder
  if (myJdk != null){
    rootModel.setSdk(myJdk);
  } else {
    rootModel.inheritSdk();
  }

  MavenUtil.runWhenInitialized(project, new DumbAwareRunnable() {
    public void run() {
      if (myEnvironmentForm != null) {
        myEnvironmentForm.setData(MavenProjectsManager.getInstance(project).getGeneralSettings());
      }

      new MavenModuleBuilderHelper(myProjectId, myAggregatorProject, myParentProject, myInheritGroupId,
                                   myInheritVersion, myArchetype, myPropertiesToCreateByArtifact, "Create new Maven module").configure(project, root, false);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:MavenModuleBuilder.java


示例11: preConfigFacets

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
public void preConfigFacets() {
  MavenUtil.invokeAndWaitWriteAction(myModule.getProject(), new Runnable() {
    public void run() {
      if (myModule.isDisposed()) return;

      final ModuleType moduleType = ModuleType.get(myModule);

      for (final MavenImporter importer : getSuitableImporters()) {
        final MavenProjectChanges changes;
        if (myMavenProjectChanges == null) {
          if (importer.processChangedModulesOnly()) continue;
          changes = MavenProjectChanges.NONE;
        }
        else {
          changes = myMavenProjectChanges;
        }

        if (importer.getModuleType() == moduleType) {
          importer.preProcess(myModule, myMavenProject, changes, myModifiableModelsProvider);
        }
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:MavenModuleImporter.java


示例12: postConfigFacets

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
public void postConfigFacets() {
  MavenUtil.invokeAndWaitWriteAction(myModule.getProject(), new Runnable() {
    public void run() {
      if (myModule.isDisposed()) return;

      final ModuleType moduleType = ModuleType.get(myModule);

      for (final MavenImporter importer : getSuitableImporters()) {
        final MavenProjectChanges changes;
        if (myMavenProjectChanges == null) {
          if (importer.processChangedModulesOnly()) continue;
          changes = MavenProjectChanges.NONE;
        }
        else {
          changes = myMavenProjectChanges;
        }

        if (importer.getModuleType() == moduleType) {
          importer.postProcess(myModule, myMavenProject, changes, myModifiableModelsProvider);
        }
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:MavenModuleImporter.java


示例13: deleteObsoleteModules

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
private boolean deleteObsoleteModules() {
  final List<Module> obsoleteModules = collectObsoleteModules();
  if (obsoleteModules.isEmpty()) return false;

  setMavenizedModules(obsoleteModules, false);

  final int[] result = new int[1];
  MavenUtil.invokeAndWait(myProject, myModelsProvider.getModalityStateForQuestionDialogs(), new Runnable() {
    public void run() {
      result[0] = Messages.showYesNoDialog(myProject,
                                           ProjectBundle.message("maven.import.message.delete.obsolete", formatModules(obsoleteModules)),
                                           ProjectBundle.message("maven.project.import.title"),
                                           Messages.getQuestionIcon());
    }
  });

  if (result[0] == Messages.NO) return false;// NO

  for (Module each : obsoleteModules) {
    if (!each.isDisposed()) {
      myModuleModel.disposeModule(each);
    }
  }

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


示例14: getDescriptorsMap

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
public static Map<String, Map<String, Map<String, List<MavenPluginDescriptor>>>> getDescriptorsMap() {
  Map<String, Map<String, Map<String, List<MavenPluginDescriptor>>>> res = ourDescriptorsMap;
  if (res == null) {
    res = new HashMap<String, Map<String, Map<String, List<MavenPluginDescriptor>>>>();

    for (MavenPluginDescriptor pluginDescriptor : MavenPluginDescriptor.EP_NAME.getExtensions()) {
      Pair<String, String> pluginId = parsePluginId(pluginDescriptor.mavenId);

      Map<String, Map<String, List<MavenPluginDescriptor>>> groupMap = MavenUtil.getOrCreate(res, pluginId.second);// pluginId.second is artifactId

      Map<String, List<MavenPluginDescriptor>> goalsMap = MavenUtil.getOrCreate(groupMap, pluginId.first);// pluginId.first is groupId

      List<MavenPluginDescriptor> descriptorList = goalsMap.get(pluginDescriptor.goal);
      if (descriptorList == null) {
        descriptorList = new SmartList<MavenPluginDescriptor>();
        goalsMap.put(pluginDescriptor.goal, descriptorList);
      }

      descriptorList.add(pluginDescriptor);
    }

    ourDescriptorsMap = res;
  }

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


示例15: setupRootModel

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
    final Project project = rootModel.getProject();

    final VirtualFile root = createAndGetContentEntry();
    rootModel.addContentEntry(root);

    // todo this should be moved to generic ModuleBuilder
    if (myJdk != null){
        rootModel.setSdk(myJdk);
    } else {
        rootModel.inheritSdk();
    }

    MavenUtil.runWhenInitialized(
        project, new DumbAwareRunnable() {
        public void run() {
            if (myEnvironmentForm != null) {
                myEnvironmentForm.setData(MavenProjectsManager.getInstance(project).getGeneralSettings());
            }

            new MavenModuleBuilderHelper(myProjectId, myAggregatorProject, myParentProject, myInheritGroupId,
                myInheritVersion, archetypeTemplate.getMavenArchetype(), myPropertiesToCreateByArtifact, "Create new Sling Maven module").configure(project, root, false);
            }
        }
    );
}
 
开发者ID:headwirecom,项目名称:aem-ide-tooling-4-intellij,代码行数:27,代码来源:SlingMavenModuleBuilder.java


示例16: runConfiguration

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
public static void runConfiguration(Project project,
                                    @NotNull MavenRunnerParameters params,
                                    @Nullable MavenGeneralSettings settings,
                                    @Nullable MavenRunnerSettings runnerSettings,
                                    @Nullable ProgramRunner.Callback callback) {
    RunnerAndConfigurationSettings configSettings = createRunnerAndConfigurationSettings(settings,
            runnerSettings,
            params,
            project);

    ProgramRunner runner = DefaultJavaProgramRunner.getInstance();
    Executor executor = DefaultRunExecutor.getRunExecutorInstance();
    ExecutionEnvironment env = new ExecutionEnvironment(executor, runner, configSettings, project);

    try {
       runner.execute(env, callback);
    }
    catch (ExecutionException e) {
        MavenUtil.showError(project, "Failed to execute Maven goal", e);
    }
}
 
开发者ID:shlxue,项目名称:MvnRunner,代码行数:22,代码来源:MvnRunConfigurationType.java


示例17: showUnsupportedNotification

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
private static void showUnsupportedNotification(@NotNull final Project project, @NotNull final VirtualFile file) {
  new Notification(MavenUtil.MAVEN_NOTIFICATION_GROUP,
                   "Unsupported action",
                   "<html>You have to <a href='#'>enable</a> <b>" + CommonBundle.settingsActionPath() + " | Maven | Importing | \"Use Maven3 to import project\"</b> option to use Show Effective POM action</html>",
                   NotificationType.ERROR,
                   new NotificationListener.Adapter() {
                     @Override
                     protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
                       MavenServerManager.getInstance().setUseMaven2(false);
                       notification.expire();

                       new Notification(MavenUtil.MAVEN_NOTIFICATION_GROUP, "Option enabled", "Option \"Use Maven3 to import project\" has been enabled", NotificationType.INFORMATION)
                         .notify(project);

                       actionPerformed(project, file);
                     }
                   }).notify(project);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:MavenShowEffectivePom.java


示例18: runConfiguration

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
public static void runConfiguration(Project project,
                                    @NotNull MavenRunnerParameters params,
                                    @Nullable MavenGeneralSettings settings,
                                    @Nullable  MavenRunnerSettings runnerSettings,
                                    @Nullable ProgramRunner.Callback callback) {
  RunnerAndConfigurationSettings configSettings = createRunnerAndConfigurationSettings(settings,
                                                                                       runnerSettings,
                                                                                       params,
                                                                                       project);

  ProgramRunner runner = DefaultJavaProgramRunner.getInstance();
  Executor executor = DefaultRunExecutor.getRunExecutorInstance();
  ExecutionEnvironment env = new ExecutionEnvironment(executor, runner, configSettings, project);

  try {
    runner.execute(env, callback);
  }
  catch (ExecutionException e) {
    MavenUtil.showError(project, "Failed to execute Maven goal", e);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:MavenRunConfigurationType.java


示例19: setupRootModel

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
  final Project project = rootModel.getProject();

  final VirtualFile root = createAndGetContentEntry();
  rootModel.addContentEntry(root);

  rootModel.inheritSdk();

  MavenUtil.runWhenInitialized(project, new DumbAwareRunnable() {
    public void run() {
      if (myEnvironmentForm != null) {
        myEnvironmentForm.setData(MavenProjectsManager.getInstance(project).getGeneralSettings());
      }

      new MavenModuleBuilderHelper(myProjectId, myAggregatorProject, myParentProject, myInheritGroupId,
                                   myInheritVersion, myArchetype, myPropertiesToCreateByArtifact, "Create new Maven module").configure(project, root, false);
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:MavenModuleBuilder.java


示例20: deleteObsoleteModules

import org.jetbrains.idea.maven.utils.MavenUtil; //导入依赖的package包/类
private boolean deleteObsoleteModules() {
  final List<Module> obsoleteModules = collectObsoleteModules();
  if (obsoleteModules.isEmpty()) return false;

  setMavenizedModules(obsoleteModules, false);

  final int[] result = new int[1];
  MavenUtil.invokeAndWait(myProject, myModelsProvider.getModalityStateForQuestionDialogs(), new Runnable() {
    public void run() {
      result[0] = Messages.showYesNoDialog(myProject,
                                           ProjectBundle.message("maven.import.message.delete.obsolete", formatModules(obsoleteModules)),
                                           ProjectBundle.message("maven.project.import.title"),
                                           Messages.getQuestionIcon());
    }
  });

  if (result[0] == 1) return false;// NO

  for (Module each : obsoleteModules) {
    if (!each.isDisposed()) {
      myModuleModel.disposeModule(each);
    }
  }

  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:MavenProjectImporter.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ResourceLoader类代码示例发布时间:2022-05-23
下一篇:
Java Open类代码示例发布时间: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